1.在监控宝上监控一台ubuntu主机。用传统的方法有点不适合,捣鼓了很久,才算监控到了数据
2.在ubuntu上安装snmpd插件
sudo apt-get install snmp snmpd -y
sudo apt-get install snmp-mibs-downloader -y
ip=$(ifconfig eth1|egrep '(inet addr:)'|awk 'BEGIN{FS=":"}{print $2}'|awk '{print $1}')
sed -i s/127.0.0.1/${ip}/g /etc/snmp/snmpd.conf
sed -i s/mibs/#mibs/g /etc/snmp/snmp.conf
/etc/init.d/snmpd restart
3.编辑文件/etc/snmp/snmpd.conf
4.加入一行
access MyROSystem "" any noauth exact all none none
5.将原有“rocommunity public default -V systemonly” 的"-V systemonly" 参数去掉,变成:
rocommunity public default
rocommunity public x.x.x.x(授权ip)
6.将“#trap2sink localhost public”和“#informsink localhost public”前面的“#”去掉,改为:
trap2sink localhost public
informsink localhost public
7.重启snmp服务
service snmpd restart
8.在其他服务器上测试
snmpwalk -v 2c -c public 目标ip