溫馨提示×

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

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

關(guān)于Nagios的NRPE服務(wù)端客戶端安裝

發(fā)布時(shí)間:2020-06-19 19:31:07 來(lái)源:網(wǎng)絡(luò) 閱讀:864 作者:Doyle_ 欄目:移動(dòng)開(kāi)發(fā)

Nagios 安裝

   準(zhǔn)備條件: Development Libraries

                      Development  Tools

    解決依賴關(guān)系: httpd gcc glibc glibc-common gd gd-devel php mysql mysql-server 


    開(kāi)始      

                 [root@localhost Desktop]  groupadd nagcmd

                 [root@localhost Desktop] useradd  —G nagcmd nagios

                 [root@localhost Desktop] passwd nagios            

                 [root@localhost Desktop] usermod -a -G nagcmd apache

                 解壓文件 

                 [root@localhost Desktop]  cd nagios-4.1.1

                 [root@localhost nagios-4.1.1]  ./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker   

                 [root@localhost nagios-4.1.1]  make all

                 [root@localhost nagios-4.1.1]  make install  #安裝nagios

                 [root@localhost nagios-4.1.1]  make install-init #安裝nogios的 

                 [root@localhost nagios-4.1.1]  make install-commandmode  #安裝命令模式 的   

                 [root@localhost nagios-4.1.1]  make install-config  #安裝配置文件的 

                 [root@localhost nagios-4.1.1]# make install-webconf   #會(huì)在/etc/httpd/conf.d/下生成nagios.conf


                  創(chuàng)建一個(gè)登陸nagios web 程序的用戶,這個(gè)用戶賬號(hào)在以后通過(guò)web  登陸nagios認(rèn)證時(shí)所用 ,這里的創(chuàng)建路徑要與 /etc/httpd/conf.d/nagios.conf里面的路徑相同 

                    [root@localhost share]# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin                    


                   # 安裝插件

                       解壓文件 

                       [root@localhost src]#    cd nagios-plugins-1.4.16

                       [root@localhost src]#  ./configure --with-nagious-user=nagios --with-nagios-group=nagios

                       [root@localhost src]#    make

                       [root@localhost src]#    make install 

                       [root@localhost nagios-plugins-1.4.16]# service httpd   restart

                       [root@localhost nagios-plugins-1.4.16]# service nagios restart


            <!--   注意: nagios里面有cgi腳本,而selinux 會(huì)阻止所以要關(guān)閉selinux-->

Nagios 配置文件講解

   配置文件所在地: /etc/nagios (與./configure的時(shí)候?qū)懙奈恢脤?duì)比)

   主配置文件:  nagios.cfg

   命令對(duì)象 : commands.cfg 

                格式 define command {

                         command_name     # 名字 

                         command_line        # 命令

                 }


             contacts.cfg

                 格式:denfine contact{

                                       contact_name    #名字全局唯一

                                       use   #繼承那個(gè)模板

                                       alias   #起一個(gè)描述名字

                                       email   接受通知的郵箱地址

                            }


     時(shí)間: timeperios.cfg 

                  格式: define timeperiod {

                               timeperiod_name

                               alias

                               sunday

                               monday

                               tuesday

                               wednesday

                               thursday

                               friday

                               saturday

                     }

      主機(jī): localhost.cfg 

                格式: define host{

                                   use 

                                   host_name

                                   alias

                                   address


                             }


        服務(wù): localhost.cfg 

               主機(jī)格式: define host {

                                   use 

                                   host_name

                                   alias

                                   address


                             }

                服務(wù)格式:

                      格式: define service{

                                   use 

                                   host_name

                                   service_description

                                   check_command

                             }


                <!--  帶register 0 就是模板-->

客戶端安裝插件

   <!--先安裝openssl-devel包-->

1)創(chuàng)建用戶

                    [root@localhost src]useradd nagios

                    [root@localhost src]passwd nagios

2)解壓插件包并進(jìn)入安裝插件

                    [root@localhost src]tar -xvf nagios-plugins-1.4.15.tar.gz 

                    [root@localhost src] cd nagios-plugins-1.4.15

                    [root@localhost nagios-plugins-1.4.15]./configure --enable-redhat-pthread-workaround

                    [root@localhost nagios-plugins-1.4.15] make 

                    [root@localhost nagios-plugins-1.4.15]make install

3)解壓NRPE包并進(jìn)入安裝NRPE

                  [root@localhost src]# tar -xvf nrpe-2.14.tar.gz 

                  [root@localhost src]# cd nrpe-2.14

                  [root@localhost src]# ./configure --with-prefix=/usr/local/nagios --enable-command-args

                  [root@localhost nrpe-2.14]# make all

                  [root@localhost nrpe-2.14]#    make install-plugin  ##安裝check_nrpe 這個(gè)插件 

                  [root@localhost nrpe-2.14]#   make install-daemon ##安裝deamon 

                  [root@localhost nrpe-2.14]#   make install-xinetd  ##安裝超級(jí)進(jìn)程

                  [root@localhost nrpe-2.14]#   cp /usr/src/nrpe-2.14/init-script /etc/init.d/nrpe

                  [root@localhost nrpe-2.14]#   chmod +x /etc/init.d/nrpe

                  [root@localhost nrpe-2.14]#   make install-daemon-config   ##安裝配置文件 

4)修改目錄權(quán)限

                  [root@localhost nrpe-2.14]# chown nagios:nagios /usr/local/nagios/

                  [root@localhost nrpe-2.14]# chown -R  nagios:nagios /usr/local/nagios/libexec/            

5) 編輯nrpe配置文件

    [root@localhost nrpe-2.14]#  vim /usr/local/nagios/etc/nrpe.cfg     

             allowed_hosts=127.0.0.1,172.16.9.128

    ##以下兩步是如果把NRPE服務(wù)交給超級(jí)進(jìn)程要更改的      

    [root@localhost nrpe-2.14]#  vim /etc/services 

      nrpe            5666/tcp


    [root@localhost nrpe-2.14]#  vim /etc/xinetd.d/nrpe

          only_from       = 127.0.0.1 172.16.9.128

服務(wù)器安裝插件

1)解壓進(jìn)入

   [root@localhost src]tar -xvf nrpe-2.14.tar.gz 

   [root@localhost src]cd nrpe-2.14

2)安裝check_nrpe 插件

               [root@localhost nrpe-2.14]#  ./configure 

               [root@localhost nrpe-2.14]#  make all

               [root@localhost nrpe-2.14]#  make install-plugin

3) 測(cè)試

              [root@localhost nrpe-2.14]#  /usr/local/nagios/libexec/check_nrpe -H 172.16.9.129


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI