一,安装所需软件net-snmp net-snmp-utils net-snmp-libs net-snmp-devel
yum install net-snmp net-snmp-utils net-snmp-libs net-snmp-devel bc
二,修复snmp配置:
vim /etc/snmp/snmp.conf 修改为:
# sec.name source community
#com2sec notConfigUser default public
com2sec notConfigUser localhost public
access notConfigGroup "" any noauth exact mib2 none none
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
三,启动snmp服务:
service snmpd start
四,设置开启启动:
chkconfig snmpd on
五,上传插件到/usr/local/nagios/libexec (插件在附件中)
六,配置
测试check_traffic 脚本:
cd /usr/local/nagios/libexec
./check_traffic -V 2c -C nagios -H localhost –L命令列出网络接口
然后更改所属 chown nagios:nagios check_traffic.sh
执行如下命令查看网卡 /usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -L (which: no bc in (/program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) Can not found command bc in you system PATH: /program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin, pleas check it *****解决办法 yum install bc )
cd /usr/local/nagios/etc
vim nrpe.cfg #添加
command[check_traffic]=/usr/local/nagios/libexec/check_traffic -V 2c -C public -H localhost -I 2 -w 2200,4000 -c 2500,4500 -K -B
-I 2 指网卡接口(就是你要监控的网卡接口)
修改chown nagios:nagios /var/tmp/check_traffic_localhost_2.hist_dat
重启nrpe 服务
七,配置监控服务器:
cd /usr/local/nagios/etc/objects
编辑vim services.cfg中添加:
define service {
use services-pnp
host_name xxx-Server
service_description check-traffic
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_traffic
}
八,测试
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com