nagios通過SNMP服務(wù)的網(wǎng)絡(luò)監(jiān)控,當(dāng)達(dá)到某個(gè)設(shè)定的值,那么就報(bào)警
成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都做網(wǎng)站、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的柘榮網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!http://bbotte.blog.51cto.com/6205307/1403997 nagios服務(wù)端和客戶端的安裝配置
http://bbotte.blog.51cto.com/6205307/1583484 Nagios結(jié)合pnp4nagios圖形監(jiān)控
借助于網(wǎng)上提供的資源,做下面的操作
https://github.com/cloved/check_traffic/releases 下載最新版本的shell腳本
下載check_traffic.sh V1.4.0,在附件已經(jīng)上傳
#被監(jiān)控端/客戶端
cd /usr/local/nagios/libexec/ #下載此腳本 chmod 755 check_traffic.sh # yum install net-snmp-utils net-snmp net-snmp-libs bc -y #因腳本里面需要用到bc # mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak # vim /etc/snmp/snmpd.conf #配置snmp服務(wù) # cat /etc/snmp/snmpd.conf|grep -v ^\# |sed '/^$/d' com2sec notConfigUser default public group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 access notConfigGroup "" any noauth exact all none none view all included .1 80 view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc access notConfigGroup "" any noauth exact all none none syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact Root(configure /etc/snmp/snmp.local.conf) dontLogTCPWrappersConnects yes # service snmpd start # snmpd -L #測試snmp配置文件 Error opening specified endpoint "" Server Exiting with code 1 # ./check_traffic.sh -V 2c -C public -H localhost -L -vvvv #測試本機(jī)的網(wǎng)口,主要的數(shù)值是index后面的數(shù)字 List Interface for host localhost. Interface index 1 orresponding to lo Interface index 2 orresponding to eth0 Interface index 3 orresponding to eth2 # ./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 2000,3000 -c 3001,5000 -K –B OK - It is the first time of this plugins to run, or some data file lost. We will get the data from the next time. # ll /var/tmp/check_traffic_127.0.0.1_2__itnms.hist_dat_64 #檢查權(quán)限,所屬用戶和組都為nagios #此腳本有幫助說明,用-h查看,上面 -I 2 即是對eth0做監(jiān)控,-w 2000,3000是流入2000K/s,或發(fā)送3000K/s會(huì)提示warning # -V 1|2c|3 # Specify the version of snmp # # -C Community # Specify the Community # # -H host # Specify the host # # -6 Use 64 bit counter, ifHC* instead of if*. # # -r Use Range instead of single value in warning and critical Threshold; # # -I interface # Specify the interface # # -N interface name # Specify the interface name # # -L List all Interfaces on specify host # # -B/b Switch to B/s or bps, default is -b, bps # # -K/M Switch to K or M (bsp,B/s), default is -K
#被監(jiān)控端/客戶端
vim /usr/local/nagios/etc/nrpe.cfg command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 2000,4000 -c 4000,6000 -K -B # service nrped restart
#監(jiān)控端/服務(wù)端
vim /usr/local/nagios/etc/objects/linuxhost.cfg define host{ use mylinux-server,service-pnp host_name 192_168_23_2 alias server tongji address 192.168.23.2 } vim /usr/local/nagios/etc/objects/linux13.cfg define service{ use linux-service,service-pnp host_name 192_168_1_2 service_description check network check_command check_nrpe!check_traffic }
完事把nagios重啟一下,剛開始會(huì)搜集數(shù)據(jù),如下面的提示 大概2分鐘就能看到圖形界面了,
PNP4Nagios Version 0.6.24
Please check the documentation for information about the following error.
XML
file
"/usr/local/pnp4nagios/var/perfdata/192_168_1_2/check_network.xml" not
found. Read FAQ
online
file [line]:
application/models/data.php [312]:
back
在nagios頁面會(huì)看到
此圖會(huì)有in,out的網(wǎng)卡流量,可以在服務(wù)器ifstat驗(yàn)證
此外,http://nagios.manubulon.com/ 這個(gè)網(wǎng)站也值得一看,里面有 http://nagios.manubulon.com/check_snmp_int.pl 腳本,同樣可以實(shí)現(xiàn)對網(wǎng)絡(luò)的監(jiān)控
附件:http://down.51cto.com/data/2365405另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。