One: Main steps
1, install the SNMPD service Pack, and set the community name to add system boot
2, deploy check_traffic.sh to Nagios 's plugin directory to libexec and authorize OH.
3, network card detection parameters.
4,nagios set the command for command.cfg, add service.cfg
Second: Specific work details
1, install SNMPD, modify content, set boot boot
Installing SNMPD
Yum Install net-snmp*
Modify snmpd.conf
Vim/etc/snmp/snmpd.conf
The contents are as follows: (note To modify the bold section)
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/C6/wKiom1gcEyHzQ1YDAAAV7tyYAV8921.png "style=" float: none; "title=" 1111111111111111111111111111.png "alt=" Wkiom1gceyhzq1ydaaav7tyyav8921.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/C3/wKioL1gcEyGg7JlVAAAgOD1PrNs356.png "style=" float: none; "title=" 2222222222222222222222222.png "alt=" Wkiol1gceygg7jlvaaagod1prns356.png "/>
Remove the comment below.
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/89/c6/wkiom1gcey7biy0haaamig2nbic404.png "title=" 33333333333333333333333.png "alt=" Wkiom1gcey7biy0haaamig2nbic404.png "/>
Setting Up system Boot
Chkconfig--add snmpdchkconfig snmpd on
2, Deploy check_traffic.sh
Upload to Nagios's installation directory/usr/lib64/nagios/plugins, and authorize 755
chmod 755 check_traffic.sh
3, network card parameter detection
./check_traffic.sh-v 2C-C Group name-H 10.60.30.52-l
[Email protected] plugins]#./check_traffic.sh-v 2c-c nagios-h 172.16.22.225-llist Interface for host 172.16.22.225.I Nterface Index 1 orresponding to Lointerface index 2 orresponding to eth0
You can test to see if the data is properly collected (if not, check the community name of the SNMPD, the IP of the monitored person, and whether SELinux is off)
./check_traffic.sh-v 2C-C Group name-H 10.60.30.52-i 2-w 1200,1500-c 1700,1800-k-B
[Email protected] plugins]#/check_traffic.sh-v 2c-c nagios-h 172.16.22.225-i 2-w 1200,1500-c 1700,1800-k-BOK- The traffic in are 0.12KB, out is 0.12KB, and is 0.24KB. The Check Interval is 30s | In=0.12kb;1200;1700;0;0 Out=0.12kb;1500;1800;0;0 Total=0.24kb;2700;3500;0;0 Interval=30s;1200;1800;0;0
Explain:
-V SNMP Protocol version
-C Community Name
The-I parameter corresponds to the network card of the above-l output index value. Flag to monitor the appropriate network card.
-W Warning value
-C Alarm Value
Configuration of the 4,nagios
Increase the command.cfg of Nagios
Vim/etc/nagios/objects/commands.cfg Add the following content define command{command_name check_traffic command_line $USER 1 $/check_traffic.sh-v 2c-c nagios-h $HOSTADDRESS $-I $ARG 1$-W $ARG 2$-c $ARG 3$-k-b}
Increase Nrpe.cfg
Vim/etc/nagios/nrpe.cfg Add the following content command[check_traffic]=/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c nagios-h 172.16.22.225-i 2-w 1200,1500-c 1700,1800-k-B
Explanation: The number of alarm parameters set by the-I network card-k–b is KB, not MB
Increase Service.cfg
Vim/etc/nagios/conf.d/172.16.22.225.cfg Add the following content define service{use Generic-service; Name of service template to use host_name 172.16.22.225 service_description check_traffic Ch Eck_command check_traffic!2!4000,5000!6000,7000; This place is set to KB, not MB}
Nagios uses check_traffic.sh to monitor network card traffic