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

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

Nagios實(shí)現(xiàn)多臺(tái)監(jiān)控

 1.Nagios監(jiān)控linux服務(wù)器平臺(tái)及所用組件,
    監(jiān)控服務(wù)器:CentOS 5.3x64(192.168.1.202)+nagios-3.2.1+ nagios-plugins-1.4.15+ nrpe_2.8.1
    被監(jiān)控端: CentOS 5.3x64(192.168.1.203)+ nagios-plugins-1.4.15+ nrpe_2.8.1

注意:兩端nrpe的版本要一致,不然無法相連接

創(chuàng)新互聯(lián)是專業(yè)的臺(tái)前網(wǎng)站建設(shè)公司,臺(tái)前接單;提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行臺(tái)前網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!

 

NRPE總共由兩部分組成:

    check_nrpe插件,運(yùn)行在監(jiān)控主機(jī)上。

    NRPE daemon,運(yùn)行在遠(yuǎn)程的linux主機(jī)上(通常就是被監(jiān)控機(jī))


2.配置監(jiān)控端
安裝nagios
useradd nagios
passwd nagios
cd nagios-3.2.1
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf        #可以自動(dòng)配置httpd.conf
安裝nagios-plugins
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
make
make install
安裝NRPE

#yum install openssl-devel(安裝 openssl包)

cd nagios-nrpe_2.8.1
./configure  #默認(rèn)自動(dòng)添加了openssl
#因?yàn)閭魉瓦^程要加密,如果后面make報(bào)錯(cuò),加如下參數(shù)
rpm -qa| grep ssl
openssl-devel-0.9.7a-43.17.el4_6.1
rpm -ql openssl-devel-0.9.7a-43.17.el4_6.1 | more
./configure --enable-ssl --with-ssl-lib=/lib/(當(dāng)然前提要有openssl)
make all
make install-plugin
commands.cfg定義外部構(gòu)件nrpe
vi /usr/local/nagios/etc/objects/commands.cfg
#添加
#check nrpe
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
配置要監(jiān)控的linux主機(jī)
vi /usr/local/nagios/etc/nagios.cfg
#中間添加
cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg
新建mylinux.cfg設(shè)置監(jiān)控內(nèi)容
vi /usr/local/nagios/etc/objects/mylinux.cfg
define host{
           use             linux-server
          host_name     mylinux
          alias           mylinux
          address        192.168.1.203(客戶端IP既被監(jiān)控的IP)
        }
define service{
        use                      generic-service
        host_name             mylinux
        service_description     check-swap
        check_command        check_nrpe!check_swap
               }
define service{
        use                      generic-service
        host_name            mylinux
        service_description     check-load
       check_command         check_nrpe!check_load
               }
define service{
        use                      generic-service
        host_name            mylinux
       service_description     check-disk
       check_command        check_nrpe!check_had1
              }
define service{
        use                     generic-service
        host_name            mylinux
       service_description     check-users
       check_command       check_nrpe!check_users
               }
define service{
        use                    generic-service
        host_name          mylinux
        service_description  otal_procs
        check_command     check_nrpe!check_total_procs
}
#這5個(gè)是默認(rèn)的監(jiān)控服務(wù),如需自定義服務(wù)可在這里添加
自定義服務(wù)可參考:http://saplingidea.javaeye.com/blog/514013
如有必要?jiǎng)t需更改check閾值,在被監(jiān)控端的/usr/local/nagios/etc/nrpe.cfg,下面會(huì)提到

其它設(shè)置
chkconfig --add nagios   #配置機(jī)器啟動(dòng)時(shí)自動(dòng)啟動(dòng)Nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg #檢查Nagios配置文件
vi /etc/selinux/config     #關(guān)閉SELinux
SELINUX=disabled
service iptables stop #關(guān)閉SELinux,或打開80,5666端口
service nagios start


2.配置被監(jiān)控端
1.安裝nagios-plugin
useradd nagios
passwd nagios
tar -zxvf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
Make
make install
改變主目錄權(quán)限
chown –R  nagios.nagios /usr/local/nagios
[root@client nagios]# ll
drwxr-xr-x 2 nagios nagios 4096 Jun 1 00:07 libexec
drwxr-xr-x 3 nagios nagios 4096 Jun 1 00:07 share
安裝客戶端的nrpe

yum install openssl-devel(安裝 openssl包)

tar -zxvf nagios-nrpe_2.8.1.orig.tar.gz
cd nagios-nrpe_2.8.1
./configure (會(huì)自動(dòng)加載SSL)
#如果后面make報(bào)錯(cuò),加如下參數(shù)
./configure --enable-ssl --with-ssl-lib=/usr/lib/(當(dāng)然前提要有openssl)
make all
make install-plugin
make install-daemon
make install-daemon-config
配置nrpe信息
vi /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.1.202
啟動(dòng)nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d
#上面這一步在本機(jī)上可以運(yùn)行,如通過ssh連接,則需用:/usr/local/nagios/bin/nrpe -d
vi /etc/rc.d/rc.local
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d
驗(yàn)證nrpe
netstat -an | grep 5666
tcp     0   0 0.0.0.0:5666            0.0.0.0:*        LISTEN
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.8.1
#服務(wù)端測試
/usr/local/nagios/libexec/check_nrpe -H l92.168.1.203
NRPE v2.8.1
#常見錯(cuò)誤
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
CHECK_NRPE: Error - Could not complete SSL handshake.
配置allowed_hosts=127.0.0.1,192.168.1.202然后kill進(jìn)程再重啟就OK了
2./usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
Connection refused by host
Nrpe進(jìn)程沒有啟動(dòng)

配置監(jiān)控對像(關(guān)鍵)
    由監(jiān)控原理可知被監(jiān)控端做監(jiān)控然后傳給監(jiān)控服務(wù)器繪總,設(shè)置監(jiān)控詳細(xì)參數(shù)主要是設(shè)置被監(jiān)控端的nrpe.cfg文件
   可以看到里面監(jiān)控對象
vi /usr/local/nagios/etc/nrpe.cfg
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_hda1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1
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
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
#這里就是上面提到的check閾值,如需更改,加減后面的數(shù)值即可

 



 

新聞名稱:Nagios實(shí)現(xiàn)多臺(tái)監(jiān)控
標(biāo)題URL:http://weahome.cn/article/jhsjss.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部