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 do a basic configure of SNMP on a RedHat Enterprise Linux or CentOS. Probably it will work on many other *nix systems.

1. Installation

Run command yum install net-snmp-utils

[root@dull etc]# yum install net-snmp-utils
Loading "fastestmirror" plugin
Loading "dellsysidplugin" plugin
...
...
Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 net-snmp-utils          i386       1:5.3.1-24.el5_2.2  updates           182 k
Installing for dependencies:
 net-snmp                i386       1:5.3.1-24.el5_2.2  updates           698 k

Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 879 k
Is this ok [y/N]: y

Answer y

Downloading Packages:

(1/2): net-snmp-utils-5.3 100% |=========================| 182 kB    00:02
(2/2): net-snmp-5.3.1-24. 100% |=========================| 698 kB    00:06
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing: net-snmp                     ######################### [1/2]
  Installing: net-snmp-utils               ######################### [2/2]
Installed: net-snmp-utils.i386 1:5.3.1-24.el5_2.2
Dependency Installed: net-snmp.i386 1:5.3.1-24.el5_2.2
Complete!

Now it is installed

 

 

2. Configure

I’m careful so I do a backup of the snmpd config file.

[root@dull ~]# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org 

Create a new config file.

[root@dull ~]# vi /etc/snmp/snmpd.conf
rocommunity  public
syslocation  "PDC, Peters DataCenter"
syscontact  peter@it-slav.net

Start the snmpd service

[root@dull ~]# /etc/init.d/snmpd start

Do a snmpwalk to make sure it is working

[root@dull ~]# snmpwalk -v 1 -c public -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux dull 2.6.18-92.1.17.el5 #1 SMP Tue Nov 4 13:45:01 EST 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (16748) 0:02:47.48
SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net
SNMPv2-MIB::sysName.0 = STRING: dull
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCentral"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
...
...

Yes, it is working

And finally, make sure snmpd starts next time you restart your machine.

[root@dull ~]# chkconfig snmpd on

 

3. Monitor example

Below is an example of how it looks using op5 Monitor a Nagios based Enterprise Monitor solution.

 

 

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

 


29 Responses to “Install and configure SNMP on RHEL or CentOS”

  1. Paul Says:

    Is there any way to get around the dependency on lm_sensors? I am not comfortable installing this highly insecure package on my servers.

  2. Andrew Says:

    @Paul: This notice may help: http://www.pro-linux.de/security/4126 This vulnerability was fixed in ver. 2.9.1-r1.

  3. Anders Says:

    Hi,
    thanks for the guide, helpded me!
    But, I wonder if you have a guide for snmptraps för redhat aswell?

  4. peter Says:

    Hi Anders,

    No I do not. Avoid traps is my answer. Traps looks like a good idea but in the long term it takes away the responsibility from the owner of the problem to the poor person that handles the monitor system.

    Read my general monitoring guideline:-)
    http://www.it-slav.net/blogs/2009/08/30/general-systems-and-network-management-guidelines-part-1/

  5. Andrew Says:

    Thanks for the guide – made the install process really easy

  6. Red Branch Says:

    […] and graph performance. So view this as a beginner howto for future reference.There is good info here for beginning SNMP.1. Install SNMP daemon and Utilities yum install net-snmp-utils […]

  7. » Install and configure SNMP on Ubuntu Rezo Tekno Dodo Says:

    […] in the digital saltmineThis 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 […]

  8. Updated Nagios Monitoring | Simon Morley | Digital Savage Says:

    […] I’m playing with SNMP to monitor traffic, load etc on the critial servers. Found this simple tutorial about getting it all set up. Now all I have to do is figure out what to actually […]

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

    […] an earlier article I have described howto set it up on RHES or CentOS, it is slightly different in […]

  10. Andy Says:

    Many thanks, that made it *very* easy! 🙂

  11. salman Says:

    in the step
    [root@dull ~]# snmpwalk -v 1 -c public -O e 127.0.0.1
    which ip should i use i have dsl at home connected through router

  12. peter Says:

    This article describes how to setup the snmp agent on RHEL or Centos. Not how to retrive data from your router.

  13. salman Says:

    when i enter the command snmpwalk -v 1 -c public -O e with my own ip it says no response

  14. peter Says:

    Look into the logfiles.
    Have you started snmpd?

  15. Sathishkumar Says:

    Thanks peter 🙂 Its working well 

  16. kaba1ah Says:

    'yum install net-snmp-utils' will not install snmpd (at least on CentOS 6). 'yum install net-snmp net-snmp-utils' will do.

  17. peter Says:

    Thanks for the hint

  18. cleanup Says:

    Thanks for the tutorial – but could you remove the animated favicon with the really creepy looking guy scrolling by? I had to spent 20 min figuring out the best way to block it before I could read the blog. Not sure why you're trying to distract/freak everyone out like that. Other than that, good blog!
    As long as you have quality content, it's best to not have any useless animations..

  19. Asad Says:

    Good blog, i am running centos 6 using vmware, what ip should i put on snmpwalk command??? i am putting 127.0.0.1 but that shows no response… plz help

  20. peter Says:

    Use the ip-address of the host that you want to monitor (of course).

    Do you have a firewall running on your box?
    If yes turn that off

  21. dehnad Says:

    Hi guys,
    Is there any one who knows how to install SNMP On Centos 5.4?
    It is not possible for my client to have internet connection.

  22. peter Says:

    Install it from the CentOS DVD

  23. Linux Hits the FAN | The Linux Action Show! | Jupiter Broadcasting Says:

    […] Install and configure SNMP on RHEL or CentOS […]

  24. Need Help in configuring SNMP on linux box Says:

    […] snmpd.conf"), and you'll see things like this: http://linux.die.net/man/5/snmpd.conf http://www.it-slav.net/blogs/2008/11…hel-or-centos/ https://access.redhat.com/knowledge/…-Net-SNMP.html And, since you're using RHEL5, you should […]

  25. best voip monitoring tool Says:

    […] of Linux you're using, so we can't give you a specific guide. A brief search brings this up: http://www.it-slav.net/blogs/2008/11…hel-or-centos/ […]

  26. Gustavo Says:

    Thank you

  27. Adam Says:

    This information was very helpful to me. Thank you for sharing this information. 

  28. ponsfrilus Says:

    Hey guys, for those are using CentOS 7, the firewall can be stopped this way:
    systemctl stop firewalld.service

  29. lirendra Says:

    The SNMP service is available in the standard CentOS repository.

    1. Install net-snmp with yum:
    yum install net-snmp

    2. Create a simple SNMP configuration:
    mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
    vim /etc/snmp/snmpd.conf

    Add the following to /etc/snmp/snmpd.conf ; Replace 1.2.3.4 with the IP address of the server that you want to allow SNMP lookups from:
    rocommunity public 1.2.3.4

    3. Start the SNMP service, and set it to auto-start on reboot:
    /etc/init.d/snmpd start
    chkconfig snmpd on

    If you have a firewall configured, ensure that you have UDP port 161 open to your SNMP lookup server.

    On your SNMP lookup server, you can do the following to perform a quick SNMP test to ensure that it’s working. Replace 1.2.3.3 with the server’s address that you just configured SNMP on:
    snmpwalk -v 2c -c public 1.2.3.3

Leave a Reply

Filled Under: centos, english, Hints, sysadmin




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!