IT How Tos

Home

About

Sitemap

Contact

How to Install SNMP on CentOS

  • Needs reviewing

Install and Configure

yum -y install net-snmp net-snmp-utils
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
vim /etc/snmp/snmpd.conf

Config file:

# Map 'idv90we3rnov90wer' community to the 'ConfigUser'
# Map '209ijvfwer0df92jd' community to the 'AllUser'
# sec.name source community
com2sec ConfigUser default idv90we3rnov90wer
com2sec AllUser default 209ijvfwer0df92jd
# Map 'ConfigUser' to 'ConfigGroup' for SNMP Version 2c
# Map 'AllUser' to 'AllGroup' for SNMP Version 2c
# sec.model sec.name
group ConfigGroup v2c ConfigUser
group AllGroup v2c AllUser
# Define 'SystemView', which includes everything under .1.3.6.1.2.1.1 (or .1.3.6.1.2.1.25.1)
# Define 'AllView', which includes everything under .1
# incl/excl subtree
view SystemView included .1.3.6.1.2.1.1
view SystemView included .1.3.6.1.2.1.25.1.1
view AllView included .1
# Give 'ConfigGroup' read access to objects in the view 'SystemView'
# Give 'AllGroup' read access to objects in the view 'AllView'
# context model level prefix read write notify
access ConfigGroup "" any noauth exact SystemView none none
access AllGroup "" any noauth exact AllView none none

Restart Service

service snmpd restart

  • Ouput: Redirecting to /bin/systemctl restart snmpd.service
    # This happens in CentOS 7

Enable

# chkconfig snmpd on

  • Output:
    • Note: Forwarding request to ‘systemctl enable snmpd.service’. # This happens on CentOS 7
    • Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.

Test the service

snmpwalk -v 2c -c idv90we3rnov90wer -O e 127.0.0.1

  • or

snmpwalk -v 2c -c 209ijvfwer0df92jd -O e 127.0.0.1

Test Remotely

snmpwalk -v 2c -c idv90we3rnov90wer -r

  • or

snmpwalk -v 2c -c 209ijvfwer0df92jd -O e 127.0.0.1

Reference