分类: 系统运维
2011-11-03 19:00:36
cacti SNMP error 错误一般是配置文件没改对导致的
cacti中被监控主机snmp文件设置
[root@localhost ~]# vim /etc/snmp/snmpd.conf
com2sec notConfigUser default public
改为
com2sec notConfigUser 202.173.231.112 public
中间的IP为cacti安装的服务器IP
access notConfigGroup "" any noauth exact systemview none none
改为
access notConfigGroup "" any noauth exact all none none
注:要把systemview改为all,不是只去掉systemview
#view all included .1 80
去掉#注释,保存退出。上面几个地方不改会导致得不到数据。
在cacti服务器测试命令:snmpwalk -v 2c -c public 被监控IP
如果输出很多内容说明成功,如果输出Timeout: No Response from IP 说明失败
=========================
snmpd 已死,但是 subsys 被锁 问题
一般是重启服务器导致的,处理方式如下
查找问题方法:
登录服务器
[root@localhost ~]# service snmpd status
snmpd 已停
[root@localhost ~]# service snmpd start
启动 snmpd: [ 确定 ]
[root@localhost ~]# service snmpd status
snmpd 已死,但是 subsys 被锁
--------------------------------------------
解决方法:
更新snmpd脚本
[root@localhost ~]# vim /etc/init.d/snmpd
killproc /usr/sbin/snmpd
改为
killall /usr/sbin/snmpd
rm -f /var/lock/subsys/snmpd
启动服务
[root@localhost ~]# /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a
[root@localhost ~]# service snmpd status
snmpd (pid 17731) 正在运行...
注:英文版的显示下面内容:
snmpd (pid 26950) is running...
============================================
分析/etc/init.d/snmpd服务脚本。
more /etc/init.d/snmpd 启动脚本--部份段落:
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
start() {
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon /usr/sbin/snmpd $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc /usr/sbin/snmpd #可能有问题
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
fi;
echo
return $RETVAL
}
4:用如下命令方式启动snmpd服务 ok
/usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a
5:测试
[root@localhost ~]# service snmpd status
snmpd (pid 17731) 正在运行...
# snmpwalk -c public -v 2c 127.0.0.1
# snmpwalk -c public -v 2c localhost
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
6:结论
上述方法运后snmpd服务正常启动,不能启动原因--snmpd 已死,但是 subsys 被锁。
===============================
安装snmp的rpm包
as4.4下依照下面顺序安装:
[root@m176com RPMS]# rpm -ivh /opt/RPMS/elfutils-libelf-devel-0.97.1-3.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/elfutils-devel-0.97.1-3.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/beecrypt-devel-3.1.0-6.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/net-snmp-devel-5.1.2-11.EL4.7.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/net-snmp-utils-5.1.2-11.EL4.7.i386.rpm
as4.7下依照下面顺序安装:
[root@m176com RPMS]# rpm -ivh /opt/RPMS/elfutils-libelf-devel-0.97.1-5.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/elfutils-devel-0.97.1-5.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/beecrypt-devel-3.1.0-6.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/net-snmp-5.1.2-13.el4.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/net-snmp-devel-5.1.2-13.el4.i386.rpm
[root@m176com RPMS]# rpm -ivh /opt/RPMS/net-snmp-utils-5.1.2-13.el4.i386.rpm
安装完成后查询结果如下:
[root@m176com rpms]# rpm -qa | grep snmp
net-snmp-libs-5.1.2-11.EL4.7
net-snmp-utils-5.1.2-11.EL4.7
net-snmp-devel-5.1.2-11.EL4.7
net-snmp-5.1.2-11.EL4.7