nagios 預設沒有監控 windows 網絡卡流量的插件外掛,但是可以通過第三方的插件外掛指令碼實現。
1: 下載 check_traffic.sh 指令碼,上傳至 Nagios 監控站羣服務器的/usr/local/nagios/libexec 目錄下。
官方下載地址:https://github.com/cloved/check_traffic
2: 為 check_traffic.sh 賦執行許可權:
#chmod a+x /usr/local/nagios/libexec/check_traffic.sh
3: 修改 nagios 命令指令碼,新增網絡卡監控命令。

1
2
3
4
5

# vi /usr/local/nagios/etc/objects/command.cfg
define command{
        command_name    check_Interface
        command_line    $USER1$/check_traffic.sh -V $ARG1$ -C $ARG2$ -H $ARG3$ -I $ARG4$ -w $ARG5$ -c $ARG6$ -K -B
        }

 
注:-V 為 snmp 版本,-C 為 snmp 組名,-H 為 WordPress 主機,-I 為網絡卡編號。網絡卡編號可以用以下命令獲取:

1

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

 
4: 編輯監控服務檔案,新增網絡卡監控服務:

1
2
3
4
5
6
7
8
9

# vi /usr/local/nagios/etc/objects/localhost.cfg
define service{
        use                       linux-service         ; Name of service template to use
        host_name                   116.255.220.76
        service_description            Interface_traffic_media_69
        check_command                check_Interface!2c!cmh!182.118.46.69!11!23000,23000!25000,25000
        normal_check_interval           3
        notifications_enabled           1
        }

 
5: 檢視監控頁面,效果如下: