Linux下RPM安装配置snmp
时间:2010-11-18 来源:babayou
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.rpm
将
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 start
6.查看服务: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 snmpd
7.将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:off
8.确保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安装配置成功