Today we’re installing snmpd so that we can query our debian server from another remote server that will use snmp in alert scripts and pretty graphing software.
Snmpd installation is a little obtuse so here is how to do the installation on Debian Lenny.
- Install snmpd with:
sudo apt-get install snmpd
- You should be using RCS/git/etc when editing system files at work. So use the appropriate techniques for checking in and out all config files. If you’re a home user don’t worry about this step; or, maybe you should. Muhahahaha! Eh, *cough*.
- Open /etc/snmp/snmpd.conf and change to the following:
# sec.name source community
#com2sec paranoid default public
#com2sec local localhost public
com2sec local localhost mysecretcommunity
com2sec readonly 192.168.XXX.XXX mysecretcommunity
#com2sec readwrite default privateHere mysecretcommunity is the uber secret name of your community. Change this to something other than public or mycommunity — let common sense prevail. 192.168.XXX.XXX is the IP address of your remote server that will query snmpd.
- Change /etc/default/snmpd so that it contains the following line:
SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid’
Notice the lack of
127.0.0.1
?
- Save the file!
- Restart snmpd with
sudo /etc/init.d/snmpd restart
.
- Test snmpd locally:
snmpwalk -Os -c mysecretcommunity -v 1 localhost system
- Test snmpd remotely from 192.168.XXX.XXX:
snmpwalk -Os -c mysecretcommunity -v 1 192.168.YYY.YYY system
Here 192.168.YYY.YYY is the IP address of the debian server hosting snmpd.
- Verify test outputs look like:
...
sysObjectID.0 = OID: netSnmpAgentOIDs.10
sysUpTimeInstance = Timeticks: (1201) 0:00:12.01
sysContact.0 = STRING: root
sysName.0 = STRING: irsplsemos01
sysLocation.0 = STRING: Unknown
sysORLastChange.0 = Timeticks: (0) 0:00:00.00
sysORID.1 = OID: snmpFrameworkMIBCompliance
sysORID.2 = OID: snmpMPDCompliance
sysORID.3 = OID: usmMIBCompliance
sysORID.4 = OID: snmpMIB
sysORID.5 = OID: tcpMIB
sysORID.6 = OID: ip
sysORID.7 = OID: udpMIB
sysORID.8 = OID: vacmBasicGroup
...
Thats all folks!
Thanks, that really helped – espetially info about editing /etc/default/snmpd!