The following procedure will install and configure snmp daemon on your Redhat-based distribution such as CentOS & Fedora. Here are the steps:
1. Verify if snmp package is installed, there are few ways
[root@localhost ~]# rpm -qa | grep snmp
[root@localhost ~]# snmpwalk
-bash: snmpwalk: command not found
[root@localhost ~]# ls /etc/snmp*
ls: /etc/snmp*: No such file or directory
This mean net-snmp package is not installed yet
2. Install net-snmp & net-snmp-utils package via yum or up2date
CentOS/Fedora:
[root@localhost ~]# yum install net-snmp net-snmp-utils
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.usonyx.net
* extras: mirror.usonyx.net
* updates: mirror.usonyx.net
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package net-snmp.i386 1:5.3.2.2-17.el5_8.1 set to be updated
–> Processing Dependency: libsensors.so.3 for package: net-snmp
—> Package net-snmp-utils.i386 1:5.3.2.2-17.el5_8.1 set to be updated
–> Running transaction check
—> Package lm_sensors.i386 0:2.10.7-9.el5 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
net-snmp i386 1:5.3.2.2-17.el5_8.1 updates 703 k
net-snmp-utils i386 1:5.3.2.2-17.el5_8.1 updates 191 k
Installing for dependencies:
lm_sensors i386 2.10.7-9.el5 base 511 k
Transaction Summary
================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)
Total download size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): net-snmp-utils-5.3.2.2-17.el5_8.1.i386.rpm | 191 kB 00:00
(2/3): lm_sensors-2.10.7-9.el5.i386.rpm | 511 kB 00:01
(3/3): net-snmp-5.3.2.2-17.el5_8.1.i386.rpm | 703 kB 00:01
——————————————————————————–
Total 408 kB/s | 1.4 MB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lm_sensors 1/3
Installing : net-snmp 2/3
Installing : net-snmp-utils 3/3
Installed:
net-snmp.i386 1:5.3.2.2-17.el5_8.1 net-snmp-utils.i386 1:5.3.2.2-17.el5_8.1
Dependency Installed:
lm_sensors.i386 0:2.10.7-9.el5
Complete!
RHEL:
up2date -v -i net-snmp-utils net-snmp
3. Configure /etc/snmp/snmpd.conf, basic config would be specifying the community string. You can use any text editor like vi or use echo command
[root@localhost ~]# echo rocommunity freelinuxtutorials >> /etc/snmp/snmpd.conf
4. Restart snmp service
[root@localhost ~]# service snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [ OK ]
5. Check snmpd if it’s working using snmp utilities like snmpwalk. You should get an output something like this:
[root@localhost ~]# snmpwalk -v2c -c freelinuxtutorials localhost
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.18-308.13.1.el5 #1 SMP Tue Aug 21 17:10:06 EDT 2012 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (356) 0:00:03.56
Quick tip:
To make sure snmpd will start on boot, use chkconfig command
Sample:
[root@localhost init.d]# ls -l /etc/rc3.d/ | grep snmpd
lrwxrwxrwx 1 root root 15 Aug 29 15:56 K50snmpd -> ../init.d/snmpd
[root@localhost init.d]# chkconfig snmpd on
[root@localhost init.d]# ls -l /etc/rc3.d/ | grep snmpd
lrwxrwxrwx 1 root root 15 Aug 29 15:57 S50snmpd -> ../init.d/sn
Notice snmpd changed from K50 to S50, meaning snmpd will start on boot. Enjoy!
Hi there,I read your blogs named “Install and Configure SNMP client on Linux | Free Linux Tutorials” daily.Your humoristic style is awesome, keep up the good work! And you can look our website about free anonymous proxies.