In this guide I’ll be explaining how to install the SNMP service on CentOS.
The SNMP service is available in the standard CentOS repository.
1. Install net-snmp with yum:
yum install net-snmp
2. Create a simple SNMP configuration:
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org vim /etc/snmp/snmpd.conf
Add the following to /etc/snmp/snmpd.conf ; Replace 220.127.116.11 with the IP address of the server that you want to allow SNMP lookups from:
rocommunity public 18.104.22.168
3. Start the SNMP service, and set it to auto-start on reboot:
/etc/init.d/snmpd start chkconfig snmpd on
If you have a firewall configured, ensure that you have UDP port 161 open to your SNMP lookup server.
On your SNMP lookup server, you can do the following to perform a quick SNMP test to ensure that it’s working. Replace 22.214.171.124 with the server’s address that you just configured SNMP on:
snmpwalk -v 2c -c public 126.96.36.199