Nagios監控Windows的網卡流量

來源:互聯網
上載者:User

標籤:padding   index   mes   message   exec   out   linu   esc   服務啟動   

Nagios監控Windows的網卡流量

使用/usr/local/nagios/libexec/中的check_traffic.sh,不但可以監控Linux的網卡流量,也可以監控Windows伺服器的流量。

1 Check_traffic.sh用法用法

 

[[email protected] libexec]#/usr/local/nagios/libexec/check_traffic.sh -h

Usage:

./check_traffic.sh [ -v ] [ -6 ] [ -r ] -V 1|2c|3 -C snmp-community -H host [ -L ] -I interface -w in, out-warning-value  -c in, out-critical-value -K/M -B/b

Example:

./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 4 -w 200,100 -c 300,200 -K -B

We can use -r to use Range Value Options:

Example:

./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 4 -r -w 200-300,100-200 -c 100-400,50-250 -K -B

If you don‘t use -K/M -B/b options, default -K -b, corresponding to Kbps

Make sure that the check interval greater than 5 Seconds.

Or modify the Min_Interval var in this file Line 180.

And, if you want in Verbose mode, use -v, to check the debug messages in the file /tmp/check_traffic.$$.

Or use ./check_traffic.sh [ -v ] -V 1|2c|3 -C snmp-community -H host -L

To list all interfaces on specify host.

 

2 Windows用戶端的設定

在此例中使用windows 2008舉例,IP為192.168.19.142。

 

 

 

 

 

2.1 安裝SNMP服務 

Windows 2008中是通過添加feature來添加snmp服務的,詳細過程請查看附件文檔。 

而Windows2003是在控制台-添加刪除程式-添加刪除群組件-Management and Monitoring Tools中安裝snmp服務的。

2.2 配置SNMP服務

使用services.msc啟動服務控制台,設定snmp community的traps和security,如下:(詳細配置請查看附件文檔)

 

然後重啟snmp服務,可以使用cmdànetstat –an | find “161”驗證snmp服務啟動情況

3 Nagios伺服器的設定3.1 安裝net-snmp的相關組件

         # yum install –y net-snmp*

3.2 編輯command.cfg檔案

vi /usr/local/nagios/etc/object/command.cfg添加如下內容:

 

define command{

      command_name    check_bandwidth

      command_line    $USER1$/check_traffic.sh -V 2c -C snmp-community -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$,$ARG3$ -c $ARG4$,$ARG5$

        }

註:-C後參數為在伺服器上設定的community值;

-I 為大寫的i,為網卡介面的index值

-w與-c後的兩個參數分別為in/out的流量閾值

 

3.3 編輯windows.cfg主機設定檔

首先使用如下的命令查看被監控的windows主機的網卡資訊:

/usr/local/nagios/libexec/check_traffic.sh -V 2c -C snmp-community -H IPADD -L

然後會列出被監控機的網卡資訊,查看需要監控的網卡,記錄其index值即可。

如上例中所示中命令為:

/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public1 -H 192.168.19.142 –L如所示:(圖片在附件文檔中)

 

vi windows.cfg添加如下內容:

 

define service{

        use                     generic-service

        host_name               winserver

        service_description        Traffic

        check_command          check_bandwidth!10!200000!300000!400000!500000

        }

此處的10為網卡資訊的index值,此值通過如上的命令查看:

 

然後重啟nagios服務即可。

 

若安裝有PNP的話還可以查看波形圖的流量監控。

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.