Welcome to It-Slav.Net blog
Peter Andersson

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0

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.




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:
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'


# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'
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.4 = OID: SNMPv2-MIB::snmpMIB
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


82 Responses to “Install and configure SNMP on Ubuntu”

  1. Bhaskar Says:

    Superb work. It works for me.

  2. ishtiaq Says:

    This is bullshit way , i dont know how its works

    the hell is not working here

  3. Diar Says:

    Totally awesome 🙂

    Worked the first time I tried it, and I have to admit, I don’t have a clue as to what I’m doing when it comes to Linux…

    Have Cacti running on a windows machine for testing purposes, was trying to get a couple of graphs formed from a remote Linux machine, and this guide is easy to follow, and works perfectly 😉

  4. Yan Says:

    Good job it works well. It worked the first time I tired it. Ishtiaq you may want to make sure that the computer name on your command line matche with the one you’re using…

  5. etank Says:

    Exactly what I have been looking for. I was trying to set up my ubuntu box the same way I did my CentOS server. Completely missed the /etc/default/snmpd changes.

    Thanks for the help.

  6. Diar Says:

    Just for the sake of completion, just used the same settings for my Windows machine running Net-SNMP, and it appears to work. Except for the fact that the files are in different locations 🙂

    Although with a little thinking and searching, it’s not that hard to adapt it for a Windows environment.

    Now all my machines work the way I want them with Cacti, awesome 😉

  7. Sureshkumar Says:

    Superba work……… Thanks

  8. Carrasco Says:

    How to enable wireless parameters?

  9. peter Says:

    I do not understand the question?

  10. Lloyd Says:

    This work perfectly for me and I am an absolute novice when it comes to Unix based systems.

    I am currently working with Ubuntu Server 9.04

    No problems!

    Many thanks!!!!!

  11. Pramod Says:

    This worked to me as well . i had to poll in the squid server into Solar winds Orion monitoring . Which was successfull .

    The document to very much useful .

    Many Thanks

  12. Paul Says:

    I’m trying to set up a Citadel mail server on Ubuntu for the singular purpose of having network devices (in this case, copier/printer/scanners) report status via email. They use snmp relay to do it. When I follow the steps above, all goes well until I get to the file move. I get a “cannot stat … no such file or directory”. Any thoughts?

  13. peter Says:

    Does the file exist?

  14. Jul Says:

    this is what I got :S

    user@ubuntu904desktop:~$ sudo apt-get install snmpd
    [sudo] password for user:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following packages were automatically installed and are no longer required:
    open-vm-source zerofree fakeroot module-assistant patchutils dpatch
    Use ‘apt-get autoremove’ to remove them.
    The following NEW packages will be installed:
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 75.4kB of archives.
    After this operation, 401kB of additional disk space will be used.
    Err http://us.archive.ubuntu.com jaunty/main snmpd 5.4.1~dfsg-12ubuntu3
    Could not resolve ‘us.archive.ubuntu.com’
    Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/n/net-snmp/snmpd_5.4.1~dfsg-12ubuntu3_i386.deb Could not resolve ‘us.archive.ubuntu.com’
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

    Apparently not working !!! TT

  15. peter Says:

    Jul: Could not resolve ‘us.archive.ubuntu.com’ means that you cannot connect to your repositories.
    Try apt-get update as your computer suggest.

    Golfer: Thanks

  16. golfer Says:

    With the internet inundated with so much crap, thank you so much for an ACTUAL helpful post. I spent so much time scouring the web for walkthroughs. I applaud you, good sir.

  17. Jul Says:

    thanks for the help !

  18. Ram Parashar Says:

    Very use full.
    Thanks a ton.

  19. Qais Says:

    Works perfect 🙂 great job

  20. JIm Says:

    Thank you for this. It’s far more simple and straightforward than the snmpconf or manpage for simple, no-frills SNMP monitoring.


  21. Geofferey Says:

    Thanks a lot man I really appreciate the help, your guide was simple and easy to use and I got it up in minutes.

  22. cas Says:

    Great walkthrough.. not a problem encountered on Ubuntu 9.10

  23. Bala Krishna Says:

    Thanks for the information. Helped me a lot.

  24. Rene Says:

    Thank you so m,much it worked i needed SNMP for cacti system
    http://www.cacti.net and i can monitor now the applications on my windows network

    So cool

    Thank you so much

  25. I need troubleshooting help for Nagios3.2. SNMP CRITICAL for Port 1 status always? Says:

    […] Originally Posted by rahimrh Dear Forum, I am using Ubuntu Linux 9.0.4 and Nagios 3.2.0. Snmp is installed at my machine and configured and its seems its working fine to check the uptime of a switch 'Uptime' it shows the right status and displays SNMP OK…..); it's has configured as below: service_description Uptime check_command check_snmp!-C public -o sysUpTime.0 However if I use another service (for port status) as below, it show SNMP Critical (down 2) always AND I need help for troublehsooting this: service_description Port 1 Link Status check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB Thanks Does this help? http://www.it-slav.net/blogs/2009/02…nmp-on-ubuntu/ […]

  26. Dambar Raj Paudel Says:

    Thank you very much for nice tutorial. Thank you for easy tutorial.

  27. V Says:

    Works for me! many thanks

  28. DJ Says:

    Brilliant. Even my windows friends understood this easy enough. Thanks.

  29. Install and configure SNMP on Ubuntu « Dharsankumaran3's Blog Says:

    […] Install and configure SNMP on Ubuntu Posted: September 18, 2010 by dharsankumaran3 in Uncategorized 0 Install and configure SNMP on Ubuntu […]

  30. shaheen abdul gafoor Says:

    i have installed net-SNMP on my ubuntu system which is running on a virtual box and i dont know how to access the SNMP,, could u pls help with this

  31. peter Says:

    Follow my guide and you will be up and running.

  32. Preeti Says:

    It works perfectly!!! thanks….

  33. Ravichandra Says:

    HI peter, I did follow your instructions, but sadly I could not get any output.
    root@ravichandra-Inspiron-1525:/etc/snmp# snmpwalk -v 1 -c mycommunityro -O e ravichandra-Inspiron-1525
    End of MIB

    Something Wrong?

  34. peter Says:

    Is the snmpd started?

  35. MarcoPCR Says:

    Works great! It took less than 2 minutes to have SNMP up and running!

    Many many thanks!!!

  36. kalpana Says:

    I’m working on snmp.while im trying to configure net-snmp-5.5 i’m getting the error like this.

    root#snmpset -v 2c -c readwrite localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 1

    Error in packet. Reason: notWritable (That object does not support modification) Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0

    can anyone please help me

  37. peter Says:

    Well, my guess is that you you try to modify a SNMP variable that cannot be changed.

  38. David Says:

    Worked fine for me, thanks.

  39. vaibhav Says:

    hi friends
    i am new to the linux….and i want to install the snmp on my local system.But while installing i had some problem regarding snmp.conf file.When install snmp package snmp.conf file is not created in /etc/snmp folder..So plz suggest me the solution….

  40. peter Says:

    It is snmpd.conf, not snmp.conf
    To find it run:
    locate snmpd.conf

  41. vaibhav Says:

    when i type the locate snmpd.conf it shows that the file is existing but when i go to the actual snmp dir and then try to find snmpd.conf file through ls command it doesn’t show any file.

  42. vaibhav Says:

    i deinstall all the snmpd packages and again made a free installation of snmp but at this time i don’t get the snmpd.conf, snmptrapd.conf.i don’t know why this happens.Plz give me solution

  43. peter Says:

    You give me to little information of what you have done to be able to help you.
    What is free installation of snmp?
    How did you uninstall? and why?

  44. UbuntuUser Says:

    it works great;
    configured on Ubuntu Desktop; 8.x, 10.x and Server 10.x 🙂

  45. vaibhav Says:

    I am trying to install mrtg….i am in the last step in completing the process but when i entered the command..
    indexmaker –output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
    it gives the following error.
    Use of uninitialized value $first in hash element at /usr/bin/indexmaker line 353.

    I searched it on google but i don’t get the proper answer..plz help me out..

  46. peter Says:

    I have no clue. I have not used mrtg, only cacti.

  47. head Says:

    i had to apt-get install snmp to make snmpwalk work

    ubuntu 10.04 server i386

    tnx helped alot

  48. Install and configure SNMP on Ubuntu « About Something… Says:

    […] the number 1 monitor tool Source: http://www.it-slav.net/blogs/2009/02/05/install-and-configure-snmp-on-ubuntu/ GA_googleAddAttr("AdOpt", "1"); GA_googleAddAttr("Origin", "other"); […]

  49. M.Ram Murthy Says:

    I have installed snmp successfully,but i request you to please give some info about monitoring in the LAN network using snmp.
    And i presently using nagios tool for monitoring the systems.

  50. peter Says:

    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

  51. mAd-1 Says:

    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:.

  52. fixer Says:

    Bout damn time someone with common sense published a tut people can understand, thanks, now I have snmpd working, how secure is this anyway?

  53. peter Says:

    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.

  54. chris Says:

    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.

  55. B Khuwera Says:

    Works fine in ubuntu EBox 1 in my old client ..
    thx ..


  56. Sanjay Says:

    Hi Peter,
    I am new to linux.Please leme know how to install SNMP services in rehel 5.7.

  57. peter Says:


  58. alvin Says:

    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.


  59. peter Says:

    I need more info to be able to answer this question.

    What works?
    Have you tried snmpwalk?

  60. frostie Says:

    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.

  61. Rachid Says:

    it does not work with monitoring switches?

  62. Rachid Says:

    If my readonly password for de switches = test, shuld i use “rocommunity test”?

  63. Rachid Says:

    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?

  64. peter Says:

    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.

  65. giri Says:

    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.

  66. Dan Says:

    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
    I get this failing response:
    SNMPv2-SMI::enterprises.15291. = 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???

  67. jbpandit Says:

    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

  68. srinija Says:

    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?

  69. jonathan Says:

    if you have two nic cards whats the best way to do it?

  70. peter Says:

    Of course it depends on what you want todo.

  71. Khalid Says:

    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.

  72. Pavan G Jakati Says:

    Thanks a ton for such a valuable information . It has helped a lot . Keep up the good work

  73. Mike Maki Says:

    You rock, Peter. Couldn't get this from the man page and I tried a few times.

  74. Darin Hess Says:

    Nice work!  I am fairly new to SNMP and this helped a lot!
    Thanks Peter!

  75. Serge Says:

    I've installed snmpd via apt-get, but there's no script /etc/init.d/snmpd after installation. Help!

  76. OMSPL Says:

    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.

  77. Tyo Says:

    Thank you very much!

  78. Adnan Says:

    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!!!

  79. Ednawan Says:

    Thx u soo much its work for me… :

  80. Seth S Says:

    I looked at over configuration guides for this. your configuration was the only one that worked. Thank you!

  81. Frank Says:

    Works, thanks!

Leave a Reply

Book reviews
FreePBX 2.5
Powerful Telephony Solutions

Asterisk 1.6
Build a feature rich telephony system with Asterisk

Learning NAGIOS 3.0

Cacti 0.8 Network Monitoring,
Monitor your network with ease!