This guide describe howto install and configure SNMP on Ubuntu.
In an earlier article I have described howto set it up on RHES or CentOS, it is slightly different in Ubuntu.
1.Installation
root@ibsen:~# sudo apt-get install snmpd Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libmpich1.0gf libdc1394-22 genisoimage linux-headers-2.6.27-7 libgfortran2 dvd+rw-tools linux-headers-2.6.27-7-generic libcarp-clan-perl libxml-xql-perl libparse-yapp-perl rdate python-xml localechooser-data gcc-4.2-base libimage-size-perl libdebconfclient0 libvisual-0.4-0 libmyth-python perlmagick libvisual-0.4-plugins libavdevice52 Use 'apt-get autoremove' to remove them. The following extra packages will be installed: libperl5.10 libsensors3 libsnmp-base libsnmp15 Suggested packages: lm-sensors The following NEW packages will be installed: libperl5.10 libsensors3 libsnmp-base libsnmp15 snmpd 0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded. Need to get 2463kB of archives. After this operation, 7987kB of additional disk space will be used. Do you want to continue [Y/n]?
answer y
2. Configuration
Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
Create a new /etc/snmp/snmpd.conf file:
rocommunity public syslocation "PDC, Peters DataCenter" syscontact peter@it-slav.net
Make snmpd use the newly created file and make it listen to all interfaces:
Edit /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.pid 127.0.0.1'
To:
# 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' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
and restart snmpd
/etc/init.d/snmpd restart
3. Test
Do a snmpwalk from another host against your newly configured host.
[root@op5 ~]# snmpwalk -v 1 -c public -O e ibsen 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!!
4. Monitor example
Below is an example of how it looks using op5 Monitor a Nagios based Enterprise Monitor solution.
5. Useful links
- op5 Statistics, a cacti based graph tool
- op5 Monitor, an Enterprise Class Monitoring system based on Nagios
- Net-SNMP, an open source implementation of SNMP
- Cacti, an open source graph tool
- Nagios, the number 1 monitor tool





April 21st, 2011 at 16:07
Thanks sooooo very much. I’ve been battling snmp for a few days going through a ton of guides nad forums and your insturctions were spot on to getting it up and running. You’ve managed to stop me from going bald!
.:tup tup:.
April 21st, 2011 at 21:12
M.Ram Murthy, my recommendation is to to either get the knowledge or buy it. Contact op5 at http://www.op5.com to get some help
June 11th, 2011 at 07:59
Bout damn time someone with common sense published a tut people can understand, thanks, now I have snmpd working, how secure is this anyway?
June 11th, 2011 at 20:45
Well, SNMP=Security Not My Problem
Depending on which version it is very unsafe up to rather safe. However if you followed my tutorial it is read-only and rather insensitive data. But if security concern you, do not use SNMP.
June 21st, 2011 at 20:40
This works just as fine as it is easy to use. Although for those who are not familiar with editing such files, vim or vi are useful tools to edit them. Thanks once more.
June 30th, 2011 at 11:20
Works fine in ubuntu EBox 1 in my old client ..
thx ..
Rgds
July 8th, 2011 at 16:19
Hi Peter,
I am new to linux.Please leme know how to install SNMP services in rehel 5.7.
Sanjay
July 8th, 2011 at 20:18
http://www.it-slav.net/blogs/2008/11/11/install-and-configure-snmp-on-rhel-or-centos/
September 7th, 2011 at 09:30
it’s working.
but when i add this machine to Orion Network Performance Monitor (NPM) not working.
what do i need to change.
Thanks for reaply.
Alvin
September 7th, 2011 at 09:32
I need more info to be able to answer this question.
What works?
Have you tried snmpwalk?
September 22nd, 2011 at 23:09
Nice post — I’ve come back to it many times, but…
SNMPDOPTS=’-LS5d -Lf /dev/null -u snmp -g snmp -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf’
This works much better. The daemon syslog doesn’t get hammered by debug and info messages from snmpd and this allows smux to work.
September 27th, 2011 at 11:25
it does not work with monitoring switches?
September 27th, 2011 at 11:26
If my readonly password for de switches = test, shuld i use “rocommunity test”?
September 27th, 2011 at 11:29
if my read-only password of the switch = “test”,
then I should use for ewample:
rocommunity test
syslocation “PDC, Peters DataCenter”
syscontact peter@it-slav.net
Is this correct?
September 27th, 2011 at 11:46
You have missunderstod the article, it describes howto setup SNMP on Ubuntu.
So the answer is NO!
In your monitor software, point it to your switch ip and use the community string you have in your switch.
February 27th, 2012 at 05:08
Superbe, it is working.
What configuration changes i need to do to configure the SNMPv3 user.
I just created the following on /etc/snmpd/snmpd.conf
createUser myuser MD5 "pass" DES "pass"
and restarted the service, but when i used in the snmpwalk like shown below
snmpwalk -v 3 -u mysuer -a SHA -A "pass" -x DES -X "pass" -l authPriv <ip>
getting the following error:
Error in packet.
Reason: authorizationError (access denied to that object)
What configuration i am missing here.
April 11th, 2012 at 21:58
Get writeup:
I am running Ubuntu 11.04 and I just have one configuration issue to overcome.
If I run:
snmpwalk -c public -v2c xxx.xxx.xxx.xxx system
I get a good response like this:
SNMPv2-MIB::sysDescr.0 = STRING: ModuleLite1000 Agt.6.04 SC-450
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::zeroDotZero
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68246112) 7 days, 21:34:21.12
SNMPv2-MIB::sysContact.0 = STRING: default contact name
SNMPv2-MIB::sysName.0 = STRING: defaultName
SNMPv2-MIB::sysLocation.0 = STRING: defaultLocation
SNMPv2-MIB::sysServices.0 = INTEGER: 79
If I try to access a single OIU value like this
snmpwalk -c public -v2c xxx.xxx.xxx.xxx 1.3.6.1.4.1.15291.1.3.3.1.1.31
I get this failing response:
SNMPv2-SMI::enterprises.15291.1.3.3.1.1.31 = No Such Object available on this agent at this OID
*** However, the same command works on my MacBook Pro (Snow Leopard) without any issues, so I know the remote devices are ok, but my Ubuntu configuration is not.
What is missing/Where do I look in my Ubuntu server to fix this???
Thanks,
April 21st, 2012 at 20:16
hi Mr peter
I have come here through google search and hope will get solution of my problem. I have installed net-snmp 5.7.1 on ubuntu 11.10. my installation folder is /home/jbpandit/snmp_projects/net-snmp and snmpd.conf file location is /usr/local/share/snmp. and i have not installed snmpd package from debian which you describe here. after successfull installation of snmp i have run snmpconf tool and created snmpd.conf file and is located in above folder. after that i start agent from /etc/init.d/snmpd start and it work fine, but problem is that after shut down the system and on next system boot i am not able to start agent. so what went wrong here? do i need to install snmpd package?. help please……jbpandit
April 30th, 2012 at 09:17
hi am not able to configure snmptrap can anyone pls help?
root@newuser-desktop:/usr/local/sbin# snmptrapd -f -Le
NET-SNMP version 5.6.2.pre1 AgentX subagent connected
Warning: no access control information configured.
(Config search path: /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/root/.snmp)
This receiver will *NOT* accept any incoming notifications.
couldn't open udp:162 — errno 98 ("Address already in use")
can anyone pls help where i went wrong?
August 28th, 2012 at 11:53
hi,
if you have two nic cards whats the best way to do it?
September 27th, 2012 at 20:33
Of course it depends on what you want todo.
January 24th, 2013 at 08:00
Hi,
I have installed snmp on a VM running on LINUX. And it works absolutely fine and sends the traps to the SNMP server. Now I want to move the VM to a different subnet or network. Is there any way that I can do a dynamic configuration on snmp agent that it sends traps to a local SNMP server in new network.
Thanks,
March 4th, 2013 at 13:56
Thanks a ton for such a valuable information . It has helped a lot . Keep up the good work
May 8th, 2013 at 07:57
You rock, Peter. Couldn't get this from the man page and I tried a few times.
July 12th, 2013 at 14:12
Nice work! I am fairly new to SNMP and this helped a lot!
Thanks Peter!
September 12th, 2013 at 03:53
I've installed snmpd via apt-get, but there's no script /etc/init.d/snmpd after installation. Help!
January 10th, 2014 at 11:11
January 2014 and this still works. (Tested on ubuntu 12.04)
Changed this line : SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
to : SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
in the conf file.
June 13th, 2014 at 03:23
Thank you very much!
March 25th, 2015 at 23:13
This is an excellent tutorial. I was having problem with “No response” even though my snmp agent and server are at the same server. The step 2 mentioned here has solved my problem.
Thank you very much!!!
November 9th, 2015 at 08:45
Thx u soo much its work for me… :
March 1st, 2016 at 19:31
I looked at over configuration guides for this. your configuration was the only one that worked. Thank you!
March 14th, 2016 at 15:38
Works, thanks!