How to enable SNMP Monitoring on Ubuntu Server 12.04
snmpd is an SNMP agent which binds to a port and awaits requests from SNMP management software. Upon receiving a request, it processes the request(s), collects the requested information and/or performs the requested operation(s) and returns the information to the sender.
Make sure that snmp is installed on your server : if not you must first do : apt-get snmp.
Install SNMPD
sudo apt-get install snmpd Create a backup file of snmpd.conf original file that we will edit later
sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
Create the new snmpd.conf file
sudo nano /etc/snmp/snmpd.conf
Add the file with these lines
rocommunity public syslocation "Your Location" syscontact admin@domain.com
Then edit the /etc/default/snmpd file
sudo nano /etc/default/snmpd
Disable this line below by adding # in front of the line
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
And add a new line
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
Restart the SNMPD service
sudo /etc/init.d/snmpd restart * Restarting network management services
Test snmp transfer data
Do a snmpwalk from another host against your newly configured host. the udp port do not need to be opened on the monitored host.
[root@op5 ~]# snmpwalk -v 1 -c public -O e your_ip_server_to_be_monitored SNMPv2-MIB::sysDescr.0 = STRING: Linux ibsen 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68869) 0:11:28.69 SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net SNMPv2-MIB::sysName.0 = STRING: ibsen SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCenter" SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01 SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
Yes it works!!
Cheers