nagios監控網卡流量

有個機器流量帶寬比較小,擔心跑慢,就做個流量監控

1、配置snmp

   主要配置

   com2sec notConfigUser  default      public

   此處source字段配的是default,因爲nagios服務器和cacti我放在不同服務器上了,能讓他們都訪問

   access  notConfigGroup ""      any       noauth    exact  all none none

   view all    included  .1                               80

   view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc


配置好後重啓snmpd

2、下載腳本

   下載好後放在libexec目錄,給執行權限

[root@localhost libexec]# ./check_traffic.sh -V 2c -C public -H 127.0.0.1 -L

List Interface for host 127.0.0.1.

Interface index 1 orresponding to  lo

Interface index 2 orresponding to  eth0

Interface index 3 orresponding to  eth1

找到要監控的網卡,我這裏是eth0

./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2   -w 4,6  -c 6,10  -M -b

OK - It's the first time for this plugins run. We'll get the data from the next time.

[root@server_67 libexec]# ./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2   -w 6,8  -c 8,10  -M -b

Warning - The Traffic In is 0.33Mbps, Out is 8.28Mbps, Total is 8.61Mbps. The Check Interval is 69s |In=0.33Mbps;6;8;0;0 Out=8.28Mbps;8;10;0;0 Total=8.61Mbps;14;18;0;0 Interval=69s;1200;1800;0;0

間隔需要30秒,配置好nrpe,再nagios服務器上添加,重啓nagios就好了

如果以非nagios用戶身份,手動測試執行過該腳本,請在正式使用該腳本前,刪除/var/tmp下對應測試生成的/var/tmp/check_traffic_${Host}_${Interface}.hist_dat文件,否則會造成nagios用戶無法讀寫該文件的錯誤。

V 代表snmp版本

C 代表community的名稱

H 代表主機IP

I 代表網卡號

w 、c就不必說了吧

補充:10,10 30,30(代表in,out)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章