How to configure SNMP in mininet

First, you need to install snmp on your system:

sudo apt-get install snmp snmpd

Now, procced to configure snmp with the respective information about your machine:

sudo mv /etc/snmp/snmpd.conf  /etc/snmp/
sudo vim /etc/snmp/snmpd.conf
#Add these lines
#Change public by your SecretPassword if you like
rocommunity  public
syslocation  "Somewhere"

Now, edit the snmp daemon to listen all interfaces:

sudo vim /etc/default/snmpd
Change from:
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/'

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/ -c /etc/snmp/snmpd.conf'

Now, restart the daemon with:

 /etc/init.d/snmpd restart

To check it's all ok, run this follow command:

snmpwalk -v1 -c public

If you want to use MIB filters like system, probably you will get this error:

snmpwalk -Dparse-mibs  -v1 -c public system
parse-mibs: No index
parse-mibs: cannot open MIB directory /usr/share/mibs/netsnmp
system: Unknown Object Identifier (Sub-id not found: (top) -> system)

You can try downloading all mibs with this command:

sudo apt-get install snmp-mibs-downloader
sudo echo 'mibs +ALL' >> /etc/snmp/snmp.conf
/etc/init.d/snmpd restart

Now, you can see the OID (object ID) and show the full list with:

snmptranslate -Tp

However, you can use the identificator ., instead of system, as follows:

snmpwalk -v1 -c public .

Now, to test SNMP on mininet, proceed to download and run the following test file:

sudo python

Just execute the following line on every host throught xterm to run snmpd:

/usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/ -c /etc/snmp/snmpd.conf



Popular posts from this blog

How to fix Android when developer options are not available for this user

from: can't read /var/mail/ in Python scripts

How to fix VirtualBox error when you try to import an ova file