Nagios监控网络流量
来源:互联网 发布:猎鹰9号 知乎 编辑:程序博客网 时间:2024/04/30 20:43
之前用过一款监控网络流量的插件,感觉不太好用。因为他的in和out值只能限制到一个值。下面新用一个插件in和out值能够分别定义。和以前的插件方法大概相同。
1. nagios主机安装net-snmp和RRDTOOL
2. 参照cacti,windows和linux的监控。在被监控主机上添加nagios主机IP
1. 查找以下字段
# sec.name source community
com2sec local 127.0.0.1 public
com2sec local 192.168.2.2 public
#将"comunity"字段改为你要设置的密码.比如"public".将“default”改为你想哪台机器可以看到你的snmp信息,如192.168.2.2,我这里将source修改成了nagios主机。
2. 查找以下字段
# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
#将read字段修改成all
3. 查找以下字段
# incl/excl subtree mask
view all included .1 80
#把view前的#去掉
3. 测试
重启 snmp
service snmpd restart
在被空端:
snmpwalk –c public –v 2c localhost
在主控端测试
snmpwalk -v 2c -c public 被控端ip |grep IF
如果没有if信息不能获取流量
3. 获取被控端网卡信息
[root@localhost libexec]# ./check_traffic.sh -V 2c -C public -H 192.168.2.6 -L
List Interface for host 192.168.2.6.
Interface index 1 orresponding to lo
Interface index 2 orresponding to eth0
Interface index 3 orresponding to eth1
4. 在nagios主机上添加check_traffic脚本
[root@localhost libexec]# ./check_traffic.sh -h
Usage:
./check_traffic.sh [ -v ] [ -6 ] [ -r ] -V 1|2c|3 -C snmp-community -H host [ -L ] -I interface -w in,out-warning-value -c in,out-critical-value -K/M -B/b
Example:
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 4 -w 200,100 -c 300,200 -K -B
Or -r to use Range Value Options:
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 4 -r -w 200-300,100-200 -c 100-400,50-250 -K -B
If you don't use -K/M -B/b options, default -K -b, corresponding to Kbps. (默认单位)
Make sure that the check interval greater than 5 Seconds.
Or modify the Min_Interval var in this file Line 180.
And, if you want in Verbose mode, use -v, to check the debug messages in the file /tmp/check_traffic.$$.
Or use ./check_traffic.sh [ -v ] -V 1|2c|3 -C snmp-community -H host -L
To list all interfaces on specify host.
[root@localhost libexec]# ./check_traffic.sh -V 2c -C public -H 192.168.2.6 -I 3 -w 200,300 -c 400,500 -K –B 定义in和out值分别超过200K、300K警告,超过400K,500k严重警告。
OK - It's the first time for this plugins run. We'll get the data from the next time.
第一次执行,history data file(/var/tmp/check_traffic_${Host}_${Interface}.hist_dat)不存在,因此会由此提示,可以忽略,再执行一次可以正正常获取
OK - The Traffic In is 1.3750KB, Out is 0.0KB, Total is 1.3750KB. The Check Interval is 104s |In=1.3750KB;200;400;0;0 Out=0.0KB;300;500;0;0 Total=1.3750KB;500;900;0;0 Interval=104s;1200;1800;0;0
5. 在nagios的command文件里面定义check_traffic命令
# 'check_traffic' command definition
define command{
command_name check_traffic
command_line $USER1$/check_traffic.sh -V 2c -C public -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$ -c $ARG3$ -K -B 监控单位可以自定义
}
6. 在nagios的监控对象cfg文件里面添加check_traffic
define service{
use generic-service
host_name linux
service_description traffic
check_command check_traffic!3!200,300!400,500 监控eth1网卡
} #与定义的宏对应添加参数值
- Nagios监控网络流量
- nagios网络流量监控(附pnp模板)
- 网络流量监控
- 网络流量监控
- nagios监控
- Nagios 监控
- Nagios监控
- Nagios监控
- nagios监控
- 用c#监控网络流量
- 用c#监控网络流量
- 网络流量监控(局域网)
- linux网络流量监控软件
- linux 下网络流量监控
- linux 下网络流量监控
- C#实现监控网络流量
- 监控linux 网络流量
- linux网络流量监控脚本
- COM组件开发实践(二)
- 买了N97,还“赠送了”一套sdk,自然是装上,开发自己的应用。
- Java中的static
- DDK编译的程序增加版本信息
- S60_DBMS_APIs
- Nagios监控网络流量
- COM组件开发实践(三)
- 大数据量高并发的数据库优化
- ECUG Con 2010 讲师注册及Topic征集
- JDK学习笔记之Calendar用法
- 我的书架:COM组件开发
- symbian数据库demo代码
- html frame用法
- n97 sdk 模拟器无法打开的解决方案。