亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

nagios監控linux網卡流量(check_traffic.sh)

發布時間:2020-06-29 02:16:49 來源:網絡 閱讀:21767 作者:火星小劉 欄目:移動開發

1、安裝所需組件

   yum install perl perl-devel perl-CPAN bc net-snmpd net-snmp-utils -y

   perl -MCPAN -eshell  & cpan> install Bundle::LWP

   編譯安裝nrpe(參考教程:http://2860664.blog.51cto.com/2850664/1559056


以下是被監控端設置

2、下載check_traffic.s腳本

   下載地址:https://codeload.github.com/cloved/check_traffic/zip/v1.3.11

   解壓文件后,上傳check_traffic.sh到/usr/local/nagios/libexec

   chmod +x check_traffic.sh

   chown nagios.nagcmd check_traffic.sh

3、設置snmp參數

   vi /etc/snmp/snmpd.conf

com2sec notConfigUser  被監控端IP  public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  all none none
view all    included  .1                               80
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

service snmpd start

chkconfig snmpd on

4、在被監控端測試腳本

   cd /usr/local/nagios/libexec

   ./check_traffic.sh -V 2c -C public -H 192.168.1.247 -I 2 -w 1200,1500 -c 1700,1800 -K -B

OK - The Traffic In is 0.72KB, Out is 0.60KB, Total is 1.32KB. The Check Interval is 43s |In=0.72KB;1200;1700;0;0 Out=0.60KB;1500;1800;0;0 Total=1.32KB;2700;3500;0;0 Interval=43s;1200;1800;0;0

   其中紅色為被監控端的IP地址。

4、vi /usr/local/nagios/etc/nrpe.cfg  添加

command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 192.168.1.247 -I 2 -w 1200,1500 -c 1700,1800 -K -B

   

以下是nagios主機的設置

5、服務器端測試

 

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.247 -c check_traffic

OK - The Traffic In is 0.48KB, Out is 0.11KB, Total is 0.59KB. The Check Interval is 28s |In=0.48KB;1200;1700;0;0 Out=0.11KB;1500;1800;0;0 Total=0.59KB;2700;3500;0;0 Interval=28s;1200;1800;0;0


vi /usr/local/nagios/etc/nagios.cfg  添加

   cfg_file=/usr/local/nagios/etc/objects/nginx.cfg

6、touch /usr/local/nagios/etc/objects/nginx.cfg

   vi /usr/local/nagios/etc/objects/nginx.cfg  (注意修改被監控端的IP)內容如下  

****************************************我是分割線************************************   

define host{
           use             linux-server
          host_name     nginx
          alias         nginx
          address       被監控端IP
        }
define service{
        use                      generic-service
        host_name             nginx
        service_description     check-swap
        check_command        check_nrpe!check_swap
               }
define service{
        use                      generic-service
        host_name             nginx
        service_description     check-load
       check_command         check_nrpe!check_load
               }
define service{
        use                      generic-service
        host_name             nginx
       service_description     check-disk
       check_command        check_nrpe!check_sda1
               }
define service{
        use                      generic-service
        host_name             nginx
       service_description     check-users
       check_command        check_nrpe!check_users
               }
define service{
        use                    generic-service
        host_name           nginx
        service_description  otal_procs
        check_command     check_nrpe!check_total_procs
}
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       nginx
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }
define service{
    use                     generic-service
    host_name               nginx
    service_description     nginx_status
    check_command           check_nrpe!check_nginx!
        notifications_enabled           0
        }
define service{
    use                     generic-service
    host_name               nginx
    service_description     network_traffic
    check_command           check_nrpe!check_traffic!
        notifications_enabled           0
}

****************************************我也是分割線************************************

報錯信息

7、nagios服務器報錯

Unknown - Read or Write File /var/tmp/check_traffic_192.168.1.247_2__itnms.hist_dat_64 Error with user uid=501(nagios) gid=503(nagcmd) groups=502(nagios),503(nagcmd).

解決方法:chmod nagios.nagcmd /var/tmp/check_traffic_192.168.1.247_2__itnms.hist_dat_64


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

海门市| 体育| 鄂托克旗| 麦盖提县| 平谷区| 正镶白旗| 逊克县| 冕宁县| 湾仔区| 茶陵县| 门头沟区| 综艺| 安龙县| 图们市| 营口市| 容城县| 恩施市| 兴业县| 奉节县| 富川| 扎兰屯市| 霞浦县| 舟山市| 邳州市| 漾濞| 秦安县| 囊谦县| 墨脱县| 越西县| 彭州市| 永安市| 金门县| 昌平区| 万盛区| 平陆县| 班戈县| 湖州市| 洱源县| 张家口市| 古丈县| 屏东县|