1:下载check_traffic.sh脚本,上传至Nagios监控服务器的/usr/地方/Nagios/libexec目录下。
,官方下载地址:https://github.com/cloved/check_traffic
2:为check_traffic.sh赋执行权限:
,# chmod + x/usr/local/nagios/libexec/check_traffic。sh
3:修改nagios命令脚本,添加网卡监控命令。
#,vi /usr/地方/nagios/etc/对象/command.cfg {define 命令 ,,,,,,,,,,command_name  check_Interface ,,,,,,,command_line ,,, USER1/check_traffic.sh 美元-V __arg1,美元-C 最长,美元-H 长度,美元小姐;ARG4,美元-w ARG5,美元-C ARG6,美元-K - b ,,,,,,,}
,
,注:- v为snmp版本,- c为snmp组名,- h为主机,我为网卡编号。网卡编号可以用以下命令获取:
#,/usr/地方/nagios/libexec/check_traffic.sh -V 2 c -C cmh -H 182.118.46.69 - l
,,,
4:编辑监控服务文件,添加网卡监控服务:
#,vi /usr/地方/nagios/etc/对象/localhost.cfg define 服务{ ,,,,,,,use ,,,,,,,,,,,,,,,,,,,,,, linux-service ,,,,,,,,,, Name of service template 用使用 ,,,,,,,host_name ,,,,,,,,,,,,,,,,, 116.255.220.76 ,,,,,,,service_description ,,,,,,,,,, Interface_traffic_media_69 ,,,,,,,check_command ,,,,,,,,,,,,,,, check_Interface ! 2 c !而言不啻! 182.118.46.69 ! 11 ! 23000、23000 ! 25000,25000 ,,,,,,,normal_check_interval ,,,,,,,,,, 3 ,,,,,,,notifications_enabled ,,,,,,,,,, 1 ,,,,,,,}
,,,
5:查看监控页面,效果如下:
,