溫馨提示×

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

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

centos5.5安裝nagios監(jiān)控--運(yùn)行服務(wù)監(jiān)控

發(fā)布時(shí)間:2020-07-19 12:43:29 來(lái)源:網(wǎng)絡(luò) 閱讀:313 作者:快樂學(xué)習(xí) 欄目:移動(dòng)開發(fā)

一、在nagios服務(wù)端的/usr/local/nagios/etc/下創(chuàng)建monitorhosts文件夾

#mkdir /usr/local/nagios/etc/monitorhosts

#chown nagios.nagios  /usr/local/nagios/etc/monitorhosts

編輯nagios.cfg文件,添加:

cfg_dir=/usr/local/nagios/etc/monitorhosts

并注釋cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

#/etc/init.d/nagios restart


二、編輯聯(lián)系人文件contacts.cfg

#vi /usr/local/nagios/etc/object

添加以下行:

define contact{

       contact_name                    IT#定義一個(gè)聯(lián)系人簡(jiǎn)稱

       use                             generic-contact

       alias                           IT#聯(lián)系人具體描述

       email                           聯(lián)系人郵箱

       }


define contactgroup{                            #定義聯(lián)系人組

       contactgroup_name       IT#聯(lián)系組名稱

       alias                   IT#聯(lián)系組別名

       members                 IT#聯(lián)系組成員


三、nagios服務(wù)端配置文件/usr/local/nagios/etc/monitorhosts

添加主機(jī)組:members中的主機(jī)配置文件中沒有主機(jī)組

define hostgroup{

       hostgroup_name          servers  主機(jī)組名

       alias                   Servers  主機(jī)組名描述

       members                 此處添加主機(jī)名

}

添加監(jiān)控項(xiàng):

define service{

       use                             generic-service

       host_name                       此處寫主機(jī)名

       service_description             此處寫監(jiān)控項(xiàng)

       check_command                   check_nrpe! -H IP -c check_memory

       max_check_attempts              3#最大失敗嘗試次數(shù),為1時(shí)只報(bào)警不重新檢測(cè)

       check_period                    24x7#檢測(cè)時(shí)間段

       normal_check_interval           10#常規(guī)檢測(cè)時(shí)間間隔,默認(rèn)60分(常規(guī)檢測(cè)是指無(wú)論服務(wù)狀態(tài)是否正常,檢測(cè)次數(shù)達(dá)到“最大次數(shù)”時(shí))

       retry_check_interval            2#失敗嘗試間隔時(shí)間,默認(rèn)60分(失敗嘗試是指服務(wù)狀態(tài)不正常,檢查次數(shù)達(dá)到“最大次數(shù)”時(shí))

       notifications_enabled           1#為1時(shí)發(fā)送報(bào)警郵件,為0不發(fā)送

       notification_interval           10#服務(wù)不正常時(shí)通知聯(lián)系人的時(shí)間間隔

       notification_period             24x7#通知聯(lián)系人時(shí)間段

       notification_options            w,u,c,r#通知聯(lián)系人選項(xiàng),w警告,u未知,c危急,f啟動(dòng)和停止,n不發(fā)送通知

       contact_groups                  IT#聯(lián)系人組

       }


四、被監(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_disk]=/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_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200      

command[check_swap]=/usr/local/nagios/libexec/check_swap  -w 20% -c 10%

#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d






向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