系統(tǒng)版本
創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站與策劃設(shè)計(jì),禮縣網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:禮縣等地區(qū)。禮縣做網(wǎng)站價(jià)格咨詢:18982081108
[root@localhost libexec]# cat /etc/redhat-release
CentOS release 5.6 (Final)
1 安裝和配置snmp
1)yum install net-snmp-utils net-snmp net-snmp-libs -y
2)vi /etc/snmp/snmpd.conf
把下面兩行的#號去掉
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
#view all included .1 80
把下面的語句
access notConfigGroup "" any noauth exact systemview none none
改為:
access notConfigGroup "" any noauth exact mib2 none none
3) 啟動(dòng)snmp
/etc/init.d/snmpd start
2 下載監(jiān)控流量腳本測試
wget https://raw.githubusercontent.com/cloved/check_traffic/master/check_traffic.sh --no-check-certificate ##放到/usr/local/nagios/libexec目錄下
chmod +x /usr/local/nagios/libexec/check_traffic.sh
獲取網(wǎng)卡信息
[root@localhost 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
[root@localhost libexec]# ./check_traffic.sh -V 2c -C public -H localhost -I 2 -w 1000,1200 -c 1400,1500 -K -B ## -I 后面的2 由上面的命令獲取
OK - The Traffic In is 0.11KB, Out is 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
定義in和out值分別超過1000K、1200K警告,超過1400K,1500k嚴(yán)重。(第一次運(yùn)行沒有輸出,30s后再運(yùn)行就有輸出)
3 在被監(jiān)控端定義check_traffic命令
vi /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 1000,1200 -c 1400,1500 -K -B
4 在監(jiān)控端定義服務(wù)
vi ../etc/objects/services.cfg
添加
define service{
use generic-service
host_name localhost
service_description traffic
check_command check_nrpe!check_traffic
}
5 重啟服務(wù)
pkill nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
/etc/init.d/nagios reload
6 手動(dòng)測試
[root@localhost libexec]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_traffic
OK - The Traffic In is 0.0KB, Out is 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
分享文章:nagios監(jiān)控網(wǎng)絡(luò)流量
地址分享:http://muchs.cn/article46/ihcphg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、云服務(wù)器、App開發(fā)、品牌網(wǎng)站制作、網(wǎng)站排名、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)