Saturday, November 29, 2008

HOWTO Enable snmpd process - Ubuntu

HOWTO Enable snmpd service for monitoring - Ubuntu

1.- Install snmpd (SNMP Server)
wmunguiam@server:~$ sudo apt-get install snmp snmpd

2.- Configure SNMPD by editing snmpd file
Backup snmpd file
root@server:/#$ cd /etc/default
root@server:/etc/default# cp snmpd snmpd-bckp

Edit File
root@server:/etc/default# vim snmpd
Verify:
# snmpd control (yes means start daemon).
SNMPDRUN=yes

a.-To listen on localhost only
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
b.-Or to listen on all interfaces
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'

3.- Edit snmpd.conf to customize SNMP authorization
Backup snmpd.conf file
root@server:/etc/default# cd /etc/snmp/
root@server:/etc/snmp# cp snmpd.conf snmpd.conf-bckp
Edit File
root@server:/etc/snmp# vim snmpd.conf
a.- Change from:
# sec.name source community
com2sec paranoid default public
#com2sec readonly default public
#com2sec readwrite default private
To:
#com2sec paranoid default public
com2sec local localhost n1o2c3
com2sec localnet 192.168.1.0 /24 n1o2c3
#com2sec paranoid default public
#com2sec readonly default public

#com2sec readwrite default private
b.- And security name groups from:
# sec.model sec.name
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
to:
group MyROSystem v1 local
group MyROSystem v2c local
group MyROSystem usm local
group MyROGroup v1 localnet
group MyROGroup v2c localnet
group MyROGroup usm localnet
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local

c.- Finally from:
syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root (configure /etc/snmp/snmpd.local.conf)
to:
syslocation Datacenter PERU
syscontact wmunguiam@noc.pe

4.-Restart snmpd service
root@server:/etc/snmp# /etc/init.d/snmpd restart
Restarting network management services: snmpd.
5.-Verify
root@server:/etc/snmp# snmpwalk -v 1 -c n1o2c3 localhost system
OUTPUT:
SNMPv2-MIB::sysDescr.0 = STRING: Linux server 2.6.27-9-server #1 SMP Thu Nov 20 22:56:07 UTC 2008 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (4354) 0:00:43.54
SNMPv2-MIB::sysContact.0 = STRING: wmunguiam@itus.pe
SNMPv2-MIB::sysName.0 = STRING: server
SNMPv2-MIB::sysLocation.0 = STRING: Datacenter ITUS
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
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORDescr.1 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (1) 0:00:00.01
End of MIB

3 comments:

  1. Wow thanks, I had configured snmpd but it hadn't worked. I think this will resolve the issue.

    ReplyDelete
  2. Dear Faust-C,

    Try the config and tell me if you have some issue.

    bye

    ReplyDelete
  3. Thank you - this got me up and working :-)

    David

    ReplyDelete