标签:root dev memcached 输出 walk run blog conf emc
http://suifu.blog.51cto.com/9167728/1770703
监控和被监控端都要安装和配置snmp:
[root@HE1bin]# yum install net-snmp*
[root@HE1bin]# vi /etc/snmp/snmpd.conf
41行将default均改为监控服务器ip;团体名被监控机和监控机一致,示例如下:
com2secnotConfigUser 192.168.1.250 ikongjian
62行将systemview 改为all,供所有snmp访问权限
access notConfigGroup "" any noauth exact all none none
85行将#注释符号去掉
viewall included .1 80
修改snmp级别以减少日志输出
[root@HE1 home]# vi /etc/init.d/snmpd
#OPTIONS="-LS0-6d-Lf /dev/null -p /var/run/snmpd.pid"
OPTIONS="-LS 4 d -p /var/run/snmpd.pid -a"
[root@HE1bin]# /etc/init.d/snmpd restart
Stoppingsnmpd: [ OK ]
Startingsnmpd: [ OK ]
验证snmp服务
[root@HE1 bin]# ps-ef | grep ‘snmpd‘
root 26100 1 0 11:20 ? 00:00:00 /usr/sbin/snmpd -LS 4 d -p/var/run/snmpd.pid -a
root 26114 25540 0 11:30 pts/0 00:00:00 grep snmpd
监控机修改lepus配置文件添加44,45,46行内容
[root@HE3lepus]# vi /usr/local/lepus/check_os.sh
在43行后添加44,45,46行内容
40 mem_buffered=`/usr/bin/snmpwalk -v1 -c ${community} ${ip} UCD-SNMP-MIB::memBuffer.0 |cut -d= -f2 |awk -F ‘ ‘ ‘{print $2}‘`
41 mem_cached=`/usr/bin/snmpwalk -v1 -c ${community} ${ip} UCD-SNMP-MIB::memCached.0 |cut -d= -f2 |awk -F ‘ ‘ ‘{print $2}‘`
42 mem_usage_rate=`/usr/bin/snmpdf -v1 -c ${community} ${ip} |grep "Physical"|awk ‘{print $6}‘`
43 mem_available=$[$mem_free+$mem_buffered+$mem_cached]
44 if [ -z $mem_shared ]; then
45 mem_shared=0
46 fi
[root@HE3 lepus]#python check_os.py
开始图形化界面添加主机
标签:root dev memcached 输出 walk run blog conf emc
原文地址:http://www.cnblogs.com/xiaoxu6/p/6822522.html