Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

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.

 

 

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

 

  • Share/Bookmark

27 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. peter Says:

    Could you be a little more specific?

  4. 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 ;)

  5. 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…

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

  7. 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 ;)

  8. Sureshkumar Says:

    Superba work……… Thanks

  9. Carrasco Says:

    How to enable wireless parameters?

  10. peter Says:

    I do not understand the question?

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

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

  13. 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?

  14. peter Says:

    Does the file exist?

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

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

  18. Jul Says:

    thanks for the help !

  19. Ram Parashar Says:

    Very use full.
    Thanks a ton.

  20. Qais Says:

    Works perfect :) great job

  21. JIm Says:

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

    Jim

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

  23. cas Says:

    Great walkthrough.. not a problem encountered on Ubuntu 9.10

  24. Bala Krishna Says:

    Thanks for the information. Helped me a lot.

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

  26. 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/ [...]

  27. Dambar Raj Paudel Says:

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

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!