1.查看是否安装了snmp
rpm -qa |grep snmp得到net-snmp-libs-5.3.1-14.el5输出表明已安装了net-snmp-libs-5.3.1-14.el5
2.snmp安装需依赖lm_sensors-2.10.0-3.1.x86_64.rpm,从RHEL5安装盘的第2张盘拷贝lm_sensors-2.10.0-3.1.x86_64.rpm到目标服务器。然后安装:rpm -ivh lm_sensors-2.10.0-3.1.x86_64.rpm
3.安装snmp,从RHEL5安装盘的第4张盘拷贝net-snmp-5.3.1-14.el5.x86_64.rpm到目标服务器。然后安装:rpm -ivh net-snmp-5.3.1-14.el5.x86_64.rpm4.配置snmpd.conf,vi /etc/snmp/snmpd.conf
将
access notConfigGroup "" any noauth exact systemview none none
改成:
access notConfigGroup "" any noauth exact mib2 none none
将
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
前面的注释#去掉改成:
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
修改默认的community string
# sec.name source community
com2sec notConfigUser default public
将public修改为你设置的团体名即可5.启动snmpd服务:service snmpd start6.查看服务:ps -ef|grep snmpd,得到以下信息:root 18263 1 0 17:59 ? 00:00:01 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd -a
root 18535 18069 0 18:23 pts/0 00:00:00 grep snmpd7.将snmpd设置为开机自启:chkconfig --add snmpd
chkconfig --level 345 snmpd on查看效果:chkconfig --list |grep snmpd得到效果:snmpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off8.确保snmpd服务启动时,netstat -ln |grep 161可以看到以下信息:udp 0 0 0.0.0.0:161 0.0.0.0:*
9.测试:snmpget -v 1 -c public 192.168.30.91 sysUpTime.0 ##192.168.30.91为开启snmpd服务的目标机器ip
snmpwalk -v 2c -c public -m ALL 192.168.30.91 .1.3 | more ##192.168.30.91为开启snmpd服务的目标机器ip可以返回值表示snmpd安装配置成功