Nagios監控windows網卡流量

來源:互聯網
上載者:User

標籤:   windows   控制台   service   下一步   

 nagios服務端 :192.168.5.203 

windows被監控端 192.168.5.208

  1. 在windows下安裝snmp服務,已windows server2003為例

    控制台---添加刪除程式---添加刪除windows組件---勾選管理和監視工具---下一步---完成

    650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C9/wKioL1QadmmgMMXxAADwo_FxpKs777.jpg" title="w01.png" alt="wKioL1QadmmgMMXxAADwo_FxpKs777.jpg" />

2.開啟服務,找到SNMP Service

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/C7/wKiom1QadruB8IrJAAAlhvRZ8K0996.jpg" title="w02.png" alt="wKiom1QadruB8IrJAAAlhvRZ8K0996.jpg" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C9/wKioL1Qadx3QT8LXAAIeSCZbseQ473.jpg" title="w03.png" alt="wKioL1Qadx3QT8LXAAIeSCZbseQ473.jpg" />

右擊SNMP Service---屬性---安全---勾選發送身分識別驗證陷阱,添加團體public,許可權讀寫,接受來自任何主機的SNMP資料包---確定

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/C9/wKioL1Qad4HBS9xxAAFUVJiFCsE635.jpg" title="w04.png" alt="wKioL1Qad4HBS9xxAAFUVJiFCsE635.jpg" />

重新啟動SNMP Server

查看UDP161連接埠是否存在

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/C9/wKioL1QaeEjg6yGzAAApzBV0_EM922.jpg" title="w05.png" alt="wKioL1QaeEjg6yGzAAApzBV0_EM922.jpg" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C9/wKioL1QaeFfiLjvdAABAJ_OXbpE016.jpg" title="w06.png" alt="wKioL1QaeFfiLjvdAABAJ_OXbpE016.jpg" />

3.nagios伺服器配置

查看是否安裝snmp包

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/C9/wKioL1Qaf1iAktlsAACSBu_xQiY869.jpg" title="w001.png" alt="wKioL1Qaf1iAktlsAACSBu_xQiY869.jpg" />

修改snmpd.conf,如

[[email protected] ~]# vim /etc/snmp/snmpd.conf

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C9/wKioL1Qaf-7TblEeAAK0L21EOZA676.jpg" title="w002.png" alt="wKioL1Qaf-7TblEeAAK0L21EOZA676.jpg" />

重啟snmpd

[[email protected] ~]# service snmpd restart

下載check_traffic.sh並上傳到Nagios伺服器

1)http://pan.baidu.com/s/1jGmR1S6 放到 /usr/local/nagios/libexec/ ,並給執行許可權

[[email protected] ~]# ll /usr/local/nagios/libexec/check_traffic.sh 

-rwxr-xr-x. 1 root root 26150 Mar 22  2012 /usr/local/nagios/libexec/check_traffic.sh

2)在nagios伺服器上添加檢測流量的命令

[[email protected] ~]# vim /usr/local/nagios/etc/objects/commands.cfg  

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C7/wKiom1QaetHjTKMnAACqnhG86M4347.jpg" title="w07.png" alt="wKiom1QaetHjTKMnAACqnhG86M4347.jpg" />

-C 後參數為snmpd.conf裡設定的community 值

-I 大寫i,後跟網卡借口的index值

-w 後跟網卡in,out流量 超過這個值警告

-c 後跟網卡in,out流量 超過這個值警示

-K -B  單位為KB

3)添加check_traffic服務

查看被監控端windows的網卡資訊,可以看到只有一個網卡,網卡index值為65539

# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 192.168.5.208 -L

List Interface for host 192.168.5.208.

Interface index 1 orresponding to  MS TCP Loopback interface

Interface index 65539 orresponding to  Realtek RTL8139 Family PCI Fast Ethernet NIC

[[email protected] ~]# vim /usr/local/nagios/etc/objects/windows.cfg 

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/C9/wKioL1QaftaAPvkRAABX079hLAc645.jpg" title="w09.png" alt="wKioL1QaftaAPvkRAABX079hLAc645.jpg" />


650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/C9/wKioL1QafuHj7VvKAACD5UsMSyE443.jpg" title="w08.png" alt="wKioL1QafuHj7VvKAACD5UsMSyE443.jpg" />

註:services-pnp在安裝pnp才有效

重啟nagios服務:顯示nagios進程,殺死進程,再啟動進程(建議啟動或停止就以這種方式)

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/CA/wKioL1QagI3DjnUBAAF8O2gG0Cc962.jpg" title="w10.png" alt="wKioL1QagI3DjnUBAAF8O2gG0Cc962.jpg" />[[email protected] ~]# kill 16464

[[email protected] ~]# /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

訪問監控頁面http://192.168.5.203/nagios 查看

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/CA/wKioL1Qagkyynd8TAACIAvTfRRA704.jpg" title="w11.png" alt="wKioL1Qagkyynd8TAACIAvTfRRA704.jpg" /> 總結:

1.如果監控分頁錯誤顯示  Return code of 127 is out of bounds - plugin may be missing

可能原因是添加檢測流量的命令有錯誤,仔細檢查關鍵字 路徑 格式 是否正確

2.如果監控分頁錯誤顯示  650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/49/CA/wKioL1QagxXghSCVAADINWoui4c342.jpg" title="w1.png" alt="wKioL1QagxXghSCVAADINWoui4c342.jpg" />解決方案:在nagios伺服器 清空 /var/tmp/ 裡的臨時檔案  或給/uar/tmp/ 加 777許可權

3.測試是否能擷取到被監控機網卡流量資料

[[email protected] local]# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 192.168.5.208 -I 65539 -w 200,300 -c 400,500 -K -B

若果正常,第一次測試顯示

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

第二次才會顯示採集的資料,例如

OK - The Traffic In is 0.50KB, Out is 0.0KB, Total is 0.50KB. The Check Interval is 625s |In=0.50KB;200;400;0;0 Out=0.0KB;300;500;0;0 Total=0.50KB;500;900;0;0 Interval=625s;1200;1800;0;0



本文出自 “夢三國” 部落格,謝絕轉載!

Nagios監控windows網卡流量

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.