nagios 监控流量(借助脚本)

简介:


nagios 监控流量(借助脚本)


http://www.sunchis.com/uploads/soft/364_check_traffic_v1.2.2.zip

 

# mount /dev/cdrom /media/cdrom

# rpm - ivh  /media/cdrom/Server/lm_sensors-2.10.0-3.1.i386.rpm

# rpm - ivh  /media/cdrom/Server/net-snmp-5.3.1-14.e15.i386.rpm

# rpm -ivh /media/cdrom/Server/net-snmp-utils-5.3.1-14.e15.i386.rpm

# vi /etc/snmp/snmp.conf

com2sec  notConfigUser     localhost     nagios     (原为com2sec  notConfigUser     default     public)

access   notConfigGroup "" any noauth exacth  mib2 none none    (原为access   notConfigGroup "" any noauth exacth  systemview none none)

view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc     (去掉注释符“#”即可)

:wq

# service snmpd start

# chkconfig --add snmpd

# chkconfig --level 35 snmpd on


# unzip 364_check_traffic_v1.2.2.zip

# cp check_traffic.sh  /usr/local/nagios/libexec

# chmod +x /usr/local/nagios/libexec/check_traffic.sh

# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -L   (查看所有网卡)

# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M -b (查看网卡结果中的第2个即eth0,进的流量限制为12-30m,出的流量限制为15-35m,即12为警告值,30为报警指)

# visudo

nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_traffic.sh

:wq


# vi /usr/local/nagios/etc/nrpe.cfg
 
command[check_traffic]=/usr/bin/sudo /usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M -b
 
:wq
 

# killall nrpe
 
# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
 
# vi /usr/local/nagios/etc/objects/ming.cfg

define service{
          use              generic-service
          host_name        ming
          service_description traffic
          check_command      check_nrpe!check_traffic
          normal_check_interval    2
}
 
:wq
 
 
# service nagios restart

本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/857687如需转载请自行联系原作者


yangzhimingg

相关文章
|
数据采集 运维 监控
Zabbix与乐维监控对比分析(七)——网络功能篇
本篇是Zabbix与乐维监控对比专题系列文章的第七篇——网络功能篇,具体包括IP地址管理、网络端口映射发现、网络配置备份、专线监控等功能的对比分析
208 0
Zabbix与乐维监控对比分析(七)——网络功能篇
|
运维 监控
一键部署zabbix监控平台脚本
应一位网友的要求,让我帮忙写个关于一键部署zabbix监控平台的脚本。这个脚本的思路,与我前面写的一个脚本是很相似的,所以用下班时间匆忙写了一个,算是能跑起来吧。
149 0
一键部署zabbix监控平台脚本
|
Web App开发 监控 关系型数据库
|
监控 数据安全/隐私保护 Windows