真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Nagios遠程監(jiān)控

1.添加用戶

創(chuàng)新互聯(lián)成立與2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站設(shè)計、成都網(wǎng)站制作網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元安丘做網(wǎng)站,已為上家服務(wù),為安丘各地企業(yè)和個人服務(wù),聯(lián)系電話:13518219792

[root@server3 ~]# useradd nagios
2.安裝nagios-plugins

[root@server3 ~]# tar zxf nagios-plugins-2.0.3.tar.gz
[root@server3 nagios-plugins-2.0.3]# ./configure --with-nagios-user=nagios --with
     --with-apt-get-command:
              --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
               --with-ping-command: /bin/ping -n -U -w %d -c %d %s
                       --with-ipv6: yes
                      --with-MySQL: /usr/bin/mysql_config
                    --with-openssl: yes
                     --with-gnutls: no
               --enable-extra-opts: yes
                       --with-perl: /usr/bin/perl
             --enable-perl-modules: no
                     --with-cgiurl: /nagios/cgi-bin
               --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
                   --enable-libtap: no
[root@server3 nagios-plugins-2.0.3]# make && make install

[root@server3 nagios]# pwd
/usr/local/nagios
[root@server3 nagios]# chown -R nagios.nagios *

3.安裝 NRPE

[root@server3 ~]# tar zxf nrpe-2.15.tar.gz

[root@server3 nrpe-2.15]# ./configure

General Options:
 -------------------------
 NRPE port:    5666
 NRPE user:    nagios
 NRPE group:   nagios
 Nagios user:  nagios
 Nagios group: nagios

[root@server3 nrpe-2.15]# make all

4.安裝插件、daemon和示例配置文件

#安裝nrpe-plugin插件
[root@server3 nrpe-2.15]# make install-plugin

#安裝nrpe daemon

[root@server3 nrpe-2.15]# make install-daemon
#安裝daemon配置文件

[root@server3 nrpe-2.15]# make install-daemon-config

#安裝xinetd腳本,NRPE daemon是作為xinetd下的一個服務(wù)來運行的,所以先安裝好xinetd

[root@server3 nrpe-2.15]# yum install -y xinetd 

[root@server3 nrpe-2.15]# make install-xinetd

4.修改配置文件

[root@server3 nrpe-2.15]# vim /etc/xinetd.d/nrpe   #添加nagios服務(wù)端的地址

    only_from       = 172.25.16.2        #nagios 主機 ip 地址

[root@server3 ~]# vim /usr/local/nagios/etc/nrpe.cfg

    allowed_hosts=172.25.16.2    #允許監(jiān)測主機的IP

5.編輯/etc/services文件,增加NRPE服務(wù)

nrpe            5666/tcp                 #nrpe

6.重啟服務(wù)

[root@server3 nrpe-2.15]# /etc/init.d/xinetd restart

[root@server3 nrpe-2.15]# netstat -antlp | grep 5666   #NRPE已經(jīng)啟動
tcp        0      0 :::5666                     :::*                        LISTEN      22872/xinetd    

#在監(jiān)控主機上

1.安裝NRPE,只需要check_nrpe插件,可直接從被監(jiān)測端copy

[root@server3 libexec]# scp check_nrpe 172.25.16.2:/usr/local/nagios/libexec/

[root@server2 libexec]# chown nagios.nagios check_nrpe
[root@server2 libexec]# ll check_nrpe
-rwxr-xr-x. 1 nagios nagios 76769 Aug 29 23:36 check_nrpe
[root@server2 libexec]# ./check_nrpe -H 172.25.16.3  #輸出nrpe的版本,說明監(jiān)測機check_nrpe與被監(jiān)測主機運行的nrpe daemon之間建立聯(lián)系
NRPE v2.15
[root@server2 libexec]# vim /usr/local/nagios/etc/objects/commands.cfg

    # 'check_nrpe'
    define command{
            command_name    check_nrpe
            command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c "$ARG1$"  #-c后面的參數(shù)是傳給被監(jiān)測端nrpe daemon要執(zhí)行的監(jiān)測命令,這些命令在nrpe.cfg中要求已經(jīng)定義

       }
[root@server3 ~]# grep -v '^#' /usr/local/nagios/etc/nrpe.cfg | sed '/^$/d'
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=172.25.16.2
 dont_blame_nrpe=0
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 

[root@server2 libexec]# vim /usr/local/nagios/etc/objects/services.cfg  #在這個里面定義的服務(wù)命令完全根據(jù)在被監(jiān)控端nrpe.cfg中內(nèi)置命令定義的,如上面命令所示

define service{
        use generic-service
        host_name server3.example.com
        service_description CPU Load
        check_command check_nrpe!check_load
        }
define service{
        use generic-service
        host_name server3.example.com
        service_description Current Users
        check_command check_nrpe!check_users
}

define service{
        use generic-service
        host_name server3.example.com
        service_description  / Free Space
        check_command check_nrpe!check_disk
}
define service{
        use generic-service
        host_name server3.example.com
        service_description Total Processes
        check_command  check_nrpe!check_total_procs
}

define service{
        use generic-service
        host_name server3.example.com
        service_description  Zombie Processes
        check_command check_nrpe!check_zombie_procs
}

#監(jiān)測是否有語法錯誤并測試

[root@server2 libexec]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[root@server2 objects]#/usr/local/nagios/libexec/check_nrpe -H 172.25.16.3 -c check_load

OK - load average: 0.08, 0.02, 0.01|load1=0.080;15.000;30.000;0; load5=0.020;10.000;25.000;0; load15=0.010;5.000;20.000;0;

[root@server2 objects]# /usr/local/nagios/libexec/check_nrpe -H 172.25.16.3 -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0


當(dāng)前標(biāo)題:Nagios遠程監(jiān)控
網(wǎng)頁網(wǎng)址:http://weahome.cn/article/ijooho.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部