System version
[Email protected] libexec]# cat/etc/redhat-release
CentOS Release 5.6 (Final)
1 Installing and configuring SNMP
1) Yum install net-snmp-utils Net-snmp net-snmp-libs-y
2) vi/etc/snmp/snmpd.conf
Remove the # numbers from the next two lines
#view mib2 included. Iso.org.dod.internet.mgmt.mib-2 FC
#view all included. 1 80
Put the following statement
Access Notconfiggroup "" Any noauth exact systemview none None
Switch
Access Notconfiggroup "" Any noauth exact mib2 none None
3) Start SNMP
/ETC/INIT.D/SNMPD start
2 Download Monitor Traffic script test
wget https://raw.githubusercontent.com/cloved/check_traffic/master/check_traffic.sh--no-check-certificate # #放到/ Under the Usr/local/nagios/libexec directory
chmod +x/usr/local/nagios/libexec/check_traffic.sh
Get NIC Information
[Email protected] libexec]#/check_traffic.sh-v 2c-c public-h localhost-l
List Interface for host localhost.
Interface index 1 orresponding to Lo
Interface index 2 orresponding to eth0
[Email protected] libexec]#./check_traffic.sh-v 2c-c public-h localhost-i 2-w 1000,1200-c 1400,1500-k-B # The 2 after-I is obtained by the above command
Ok-the traffic in are 0.11KB, out are 1.08KB, Total is 1.19KB. The Check Interval is 1526s | In=0.11kb;1000;1400;0;0 Out=1.08kb;1200;1500;0;0 Total=1.19kb;2200;2900;0;0 Interval=1526s;1200;1800;0;0
Define in and out values exceeding 1000K, 1200K warning, exceeding 1400k,1500k severity. (No output for first run, output after 30s)
3 Defining the check_traffic command on the monitored side
Vi/usr/local/nagios/etc/nrpe.cfg
Add to
Command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh-v 2c-c public-h 127.0.0.1-i 2-w 1000,1200-c 1400, 1500-k-B
4 Defining services on the monitoring side
VI.. /etc/objects/services.cfg
Add to
Define Service{
Use Generic-service
HOST_NAME localhost
Service_description Traffic
Check_command check_nrpe!check_traffic
}
5 Restart Service
Pkill Nrpe
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
/etc/init.d/nagios Reload
6 Manual Test
[Email protected] libexec]#/usr/local/nagios/libexec/check_nrpe-h localhost-c check_traffic
Ok-the traffic in are 0.0KB, out are 0.24KB, Total is 0.24KB. The Check Interval is 135s | In=0.0kb;200;400;0;0 Out=0.24kb;300;500;0;0 Total=0.24kb;500;900;0;0 Interval=135s;1200;1800;0;0
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"/>
Nagios Monitors network traffic