nagios流量监控的三种方法
2011-01-07 13:34
288 查看
使用nagios来监控接口流量主要有三种方法
1.使用snmp通用的做法,以下接口可以得到数据包的流量
IF-MIB::ifInOctets
snmpwalk -v 2c -c public 127.0.0.1 IF-MIB::ifInOctets
IF-MIB::ifOutOctets
snmpwalk -v 2c -c public 127.0.0.1 IF-MIB::ifOutOctets
2.使用check_traffic.sh脚本,这个个人比较偏好ITNMS石头版主很强大。
查看接口
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -L
抓取接口流量
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w200,300 -c400,500 -K -B
命令定义
define command{
command_name check_traffic
command_line /usr/lib/nagios/plugins/check_traffic.sh -V1 -C '$ARG1$' -H $HOSTADD
RESS$ -I '$ARG2$' -w '$ARG3$' -c '$ARG4$' '$ARG5$' -b
}
在这里第五个参数可以根据需要替换为M或者K
这个做流量监控还没有出现过问题,就是有时候没有装bc包的时候会报错
-bash-3.2# /usr/local/nagios/libexec/check_traffic.sh -V 1 -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M -b
/usr/local/nagios/libexec/check_traffic.sh: line 449: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 454: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 457: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 458: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 461: [: too many arguments
/usr/local/nagios/libexec/check_traffic.sh: line 576: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 577: bc: command not found
Unknown - Can not found data in the history data file. Please to check the file /var/tmp/check_traffic_localhost_2.hist_dat_root__32 ,or use use verbose mode and check the debug file
3.使用nagios自带的check_mrtgtraf来监控流量,前提是系统上面已经安装了mrtg了。让nagios来读取mrtg的流量日志数据,check_mrtgtraf -h
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-F, --filename=STRING
File to read log from
-e, --expires=INTEGER
Minutes after which log expires
-a, --aggregation=(AVG|MAX)
Test average or maximum
-w, --warning
Warning threshold pair <incoming>,<outgoing>
-c, --critical
Critical threshold pair <incoming>,<outgoing>
define command{
command_name traffic_average
command_line /usr/lib/nagios/plugins/check_mrtgtraf '$ARG1$' 10 AVG '$ARG2$' '$ARG
3$' '$ARG4$' '$ARG5$'
}
值得注意的是这里的-F参数后面的日志文件是mrtg获取的日志数据的文件名
1.使用snmp通用的做法,以下接口可以得到数据包的流量
IF-MIB::ifInOctets
snmpwalk -v 2c -c public 127.0.0.1 IF-MIB::ifInOctets
IF-MIB::ifOutOctets
snmpwalk -v 2c -c public 127.0.0.1 IF-MIB::ifOutOctets
2.使用check_traffic.sh脚本,这个个人比较偏好ITNMS石头版主很强大。
查看接口
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -L
抓取接口流量
./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w200,300 -c400,500 -K -B
命令定义
define command{
command_name check_traffic
command_line /usr/lib/nagios/plugins/check_traffic.sh -V1 -C '$ARG1$' -H $HOSTADD
RESS$ -I '$ARG2$' -w '$ARG3$' -c '$ARG4$' '$ARG5$' -b
}
在这里第五个参数可以根据需要替换为M或者K
这个做流量监控还没有出现过问题,就是有时候没有装bc包的时候会报错
-bash-3.2# /usr/local/nagios/libexec/check_traffic.sh -V 1 -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M -b
/usr/local/nagios/libexec/check_traffic.sh: line 449: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 454: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 457: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 458: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 461: [: too many arguments
/usr/local/nagios/libexec/check_traffic.sh: line 576: bc: command not found
/usr/local/nagios/libexec/check_traffic.sh: line 577: bc: command not found
Unknown - Can not found data in the history data file. Please to check the file /var/tmp/check_traffic_localhost_2.hist_dat_root__32 ,or use use verbose mode and check the debug file
3.使用nagios自带的check_mrtgtraf来监控流量,前提是系统上面已经安装了mrtg了。让nagios来读取mrtg的流量日志数据,check_mrtgtraf -h
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-F, --filename=STRING
File to read log from
-e, --expires=INTEGER
Minutes after which log expires
-a, --aggregation=(AVG|MAX)
Test average or maximum
-w, --warning
Warning threshold pair <incoming>,<outgoing>
-c, --critical
Critical threshold pair <incoming>,<outgoing>
define command{
command_name traffic_average
command_line /usr/lib/nagios/plugins/check_mrtgtraf '$ARG1$' 10 AVG '$ARG2$' '$ARG
3$' '$ARG4$' '$ARG5$'
}
值得注意的是这里的-F参数后面的日志文件是mrtg获取的日志数据的文件名
相关文章推荐
- nagios监控网址流量的方法
- Android编程实现监控各个程序流量的方法
- nagios监控网卡流量
- nagios监控网卡流量
- nagios 流量监控和报警的shell脚本
- Nagios 网卡流量监控
- nagios监控windows网卡流量
- LoadRunner监控Linux的三种方法
- nagios监控告警之网络流量监控(附pnp模板)
- Centos下利用Nload监控网卡流量的方法
- nagios 监控指定tcp端口原理和方法
- nagios监控网络流量
- nagios监控网络流量
- Nagios 监控windows网卡流量
- memcached监控的几种方法(nagios等)
- Nagios监控数据库的方法
- Nagios监控Windows Server 2008配置方法
- nagios监控网卡流量
- 三种解密 HTTPS 流量的方法介绍
- nagios 监控 网卡流量 脚本