Nearly two days in the integration of the company's monitoring or Zabbix on the gradual migration to the Nagios+ganglia platform
In network monitoring This discovery ganglia the information obtained can not be customized to MB (or maybe I did not find the configuration location)
Search from the internet found that a user has written traffic.sh script, I took to use 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0057.gif "alt=" j_0057. GIF "/>
Traffic.sh Http://pan.baidu.com/s/1o8PoDBG
Go to the Chase
Client
1. Install the SNMP component
[email protected] ~]# Yum install-y net-snmp net-snmp-libs net-snmp-utils
2. Change the configuration file/etc/snmp/snmpd.conf
Com2sec notconfiguser default public #改为 monitoring host IP
Access Notconfiggroup "" Any noauth exact systemview None # none # changed to Mib2
#View mib2 included. Iso.org.dod.internet.mgmt.mib-2 FC # Removal notes
3. Test the connection
Snmpwalk-v 2c-c public 127.0.0.1 #需要将配置文件ip临时改为127.0.0.1 the correct words will appear a lot of content
Service side
1. Move the check_traffic.sh script to the Nagios plug-in directory, this example is located in/usr/lib64/nagios/plugins/
MV check_traffic.sh /usr/lib64/nagios/plugins/
2. Change Script Permissions
chmod 755 check_traffic.sh
3. Install BC #报错信息见error 1
[email protected] plugins]# Yum install-y bc.x86_64
4.
View Network card number
[Email protected] plugins]#/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.4.41-l
Test
/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.4.41-i 2-w 300,500-c 600,800-m-B # -I 2 of 2 is the detected NIC index number
Ok-the traffic in are 33.38Mbps, out are 15.28Mbps, Total is 48.66Mbps. The Check Interval is 90s | In=33.38mbps;300;600;0;0 Out=15.28mbps;500;800;0;0 Total=48.66mbps;800;1400;0;0 Interval=90s;1200;1800;0;0
5. Add a command
Vim/etc/nagios/objects/commands.cfg
# ' check_traffic ' command definition
Define Command{
Command_name check_traffic
Command_line $USER 1$/check_traffic.sh-v 2c-c public-h $HOSTNAME $-I $ARG 1$-W $ARG 2$-c $ARG 3$-m-b
}
Vim/etc/nagios/objects/api.cfg #本例是在现有的基础上添加的
Define Service{
Use Api-service
Hostgroup_name API
Service_description check_traffic
Notifications_enabled 1
Check_command check_traffic!2!300,300!600,600
Max_check_attempts 1
}
Error 1
[Email protected] plugins]#/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.4.41-i 2-w300,500-c600 , 800-m-B
/usr/lib64/nagios/plugins/check_traffic.sh:line 449:bc:command not found
/usr/lib64/nagios/plugins/check_traffic.sh:line 454:bc:command not found
/usr/lib64/nagios/plugins/check_traffic.sh:line 457:bc:command not found
/usr/lib64/nagios/plugins/check_traffic.sh:line 458:bc:command not found
/usr/lib64/nagios/plugins/check_traffic.sh:line 461: [: Too many arguments
/usr/lib64/nagios/plugins/check_traffic.sh:line 576:bc:command not found
/usr/lib64/nagios/plugins/check_traffic.sh:line 577:bc:command not found
Workaround
Yum install-y BC
Error 2
Unknown-can not found data in the history data file. Please check the file/var/tmp/check_traffic_10.10.4.41_2.hist_dat_root__64, or use the verbose mode and check the Debu G file
Unknown is due to
The first execution, because the history data file does not exist, so this prompt, can be ignored.
If each execution is ignored, check for/var/tmp/check_traffic_${host}_${interface}.hist_dat file generation under/var/tmp.
The contents of the file are the current time of the system, in and out current values.
Thanks here, two great gods
http://blog.csdn.net/liansehai/article/details/15499767 Love astringent Sea
http://bingdian.blog.51cto.com/94171/167614/
This article from "Ming Fei Growth Station" blog, declined reprint!
Nagios Network card traffic monitoring trffic.sh