自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

escalations限制Nagios報(bào)警次數(shù)

運(yùn)維 系統(tǒng)運(yùn)維
escalations限制Nagios報(bào)警次數(shù):Nagios是一個(gè)監(jiān)控系統(tǒng)運(yùn)行狀態(tài)和網(wǎng)絡(luò)信息的監(jiān)控系統(tǒng)。Nagios能監(jiān)控所指定的本地或遠(yuǎn)程主機(jī)以及服務(wù),同時(shí)提供異常通知功能等。這篇文章主要講的是escalations限制Nagios報(bào)警次數(shù)

  escalations限制Nagios報(bào)警次數(shù)

  Nagios是非常強(qiáng)大的一款監(jiān)控工具,尤其是它的告警功能,現(xiàn)在網(wǎng)上實(shí)現(xiàn)的形式多種多樣如結(jié)合移動(dòng)139郵箱、Fetion、MSN等,但是如果服務(wù)器出現(xiàn)故障而未能及時(shí)的解決,Nagios就會(huì)不斷的發(fā)送告警信息,實(shí)在令人頭疼。現(xiàn)在用如下方法可以解決Nagios的告警次數(shù)問(wèn)題。

  系統(tǒng)環(huán)境:

  CentOS 5.2

  Nagios版本:3.0.6

  Nagios安裝路徑:/usr/local/nagios

  配置文件內(nèi)容定義:

  1.   #基本的配置就不再進(jìn)行注釋了。  
  2.  
  3.   hosts.cfg  
  4.  
  5.   define host{  
  6.  
  7.   host_name WWW-Server  
  8.  
  9.   alias WWW-Server  
  10.  
  11.   address 193.1.16.100  
  12.  
  13.   check_command check-host-alive  
  14.  
  15.   max_check_attempts 5  
  16.  
  17.   check_period 24×7  
  18.  
  19.   notification_interval 10  
  20.  
  21.   notification_period 24×7  
  22.  
  23.   notification_options d,u,r  
  24.  
  25.   notifications_enabled 1  
  26.  
  27.   contact_groups chengnan  
  28.  
  29.   }  
  30.  
  31.   Services.cfg  
  32.  
  33.   define service{  
  34.  
  35.   host_name WWW-Server  
  36.  
  37.   service_description Check_HTTP  
  38.  
  39.   check_command check_http  
  40.  
  41.   max_check_attempts 10  
  42.  
  43.   normal_check_interval 3  
  44.  
  45.   retry_check_interval 2  
  46.  
  47.   check_period 24×7  
  48.  
  49.   notification_interval 5  
  50.  
  51.   notification_period 24×7  
  52.  
  53.   notification_options w,u,c,r  
  54.  
  55.   contact_groups admin  
  56.  
  57.   }  
  58.  
  59.   define service{  
  60.  
  61.   host_name WWW-Server  
  62.  
  63.   service_description Check_Jetty  
  64.  
  65.   check_command check_tcp!8080  
  66.  
  67.   max_check_attempts 10  
  68.  
  69.   normal_check_interval 3  
  70.  
  71.   retry_check_interval 2  
  72.  
  73.   check_period 24×7  
  74.  
  75.   notification_interval 5  
  76.  
  77.   notification_period 24×7  
  78.  
  79.   notification_options w,u,c,r  
  80.  
  81.   contact_groups admin  
  82.  
  83.   }  
  84.  
  85.   Contacts.cfg  
  86.  
  87.   define contact{  
  88.  
  89.   contact_name chengnan  
  90.  
  91.   alias chengnan  
  92.  
  93.   service_notification_period 24×7  
  94.  
  95.   host_notification_period 24×7  
  96.  
  97.   service_notification_options w,u,c,r  
  98.  
  99.   host_notification_options d,u,r  
  100.  
  101.   service_notification_commands notify-service-by-email  
  102.  
  103.   host_notification_commands notify-host-by-email  
  104.  
  105.   email chengnan@139.com //手機(jī)郵箱  
  106.  
  107.   }define contactgroup{  
  108.  
  109.   contactgroup_name chengnan  
  110.  
  111.   alias Nagios Administrators  
  112.  
  113.   members chengnan  
  114.  
  115.   }  
  116.  

  除此之外再定義一個(gè)聯(lián)系人

  1.   define contact{  
  2.  
  3.   contact_name chengnan_cor  
  4.  
  5.   alias chengnan_cor  
  6.  
  7.   service_notification_period 24×7  
  8.  
  9.   host_notification_period 24×7  
  10.  
  11.   service_notification_options w,u,c,r  
  12.  
  13.   host_notification_options d,u,r  
  14.  
  15.   service_notification_commands notify-service-by-email  
  16.  
  17.   host_notification_commands notify-host-by-email  
  18.  
  19.   email chengnan@company.com //公司郵箱  
  20.  
  21.   }  
  22.  
  23.   define contactgroup{  
  24.  
  25.   contactgroup_name sysadmin  
  26.  
  27.   alias sysadmin  
  28.  
  29.   members chengnan_cor  
  30.  
  31.   }  
  32.  

  然后創(chuàng)建一個(gè)配置文件:

  1.   vi escalations.cfg  
  2.  

  escalations有自動(dòng)調(diào)整;不斷增加; 逐步上升等意思,本身配置文件的功能是當(dāng)服務(wù)在某一告警次數(shù)前沒(méi)有恢復(fù),告警頻率周期將會(huì)縮短,同時(shí)將告警信息發(fā)送至指定聯(lián)系人。

  其內(nèi)容為:

  1.   define hostescalation{  
  2.  
  3.   host_name WWW-Server //被監(jiān)控主機(jī)名稱(chēng),與Hosts.cfg中一致  
  4.  
  5.   first_notification 4 // 第n條信息起,改變頻率間隔  
  6.  
  7.   last_notification 0 // 第n條信息起,恢復(fù)頻率間隔  
  8.  
  9.   notification_interval 30 // 通知間隔(分)  
  10.  
  11.   contact_groups sysadmin  
  12.  
  13.   }  
  14.  

  說(shuō)明:從第4條告警信息起至服務(wù)器恢復(fù)前,告警信息發(fā)送至sysadmin組下的聯(lián)系人,告警間隔為30分鐘1條信息。

  1.   define serviceescalation{  
  2.  
  3.   host_name WWW-Server //被監(jiān)控主機(jī)名稱(chēng),與Hosts.cfg中一致  
  4.  
  5.   service_description Check_HTTP,Check_Jetty //被監(jiān)控服務(wù)名稱(chēng),與Services.cfg中一致  
  6.  
  7.   first_notification 4  
  8.  
  9.   last_notification 0  
  10.  
  11.   notification_interval 30  
  12.  
  13.   contact_groups sysadmin  
  14.  
  15.   }  
  16.  

  保存

  修改nagios.cfg

  vi nagios.cfg

  添加:

  1.   cfg_file=/usr/local/nagios/etc/objects/escalations.cfg  
  2.  

  檢查nagios配置文件是否正確

  1.   /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  
  2.  

  重新啟動(dòng)nagios服務(wù):

  1.   service nagios restart  
  2.  

  測(cè)試:

  服務(wù)器啟動(dòng)后停掉被監(jiān)控測(cè)試機(jī)的相應(yīng)服務(wù),確認(rèn)告警信息是否按照設(shè)置發(fā)送至不同信箱

  結(jié)束語(yǔ)

  escalations這個(gè)功能官方給的定義是notification的擴(kuò)充,使notification變得更加靈活,方便。

  文中我使用的方法算是耍了個(gè)小聰明,將第四條告警信息后的所有信息全部發(fā)送至我公司郵箱直至服務(wù)器恢復(fù)(recovery的信息還是會(huì)發(fā)送至手機(jī)的),從而實(shí)現(xiàn)限制告警信息發(fā)送至手機(jī)的條數(shù)。

【編輯推薦】

Nagios報(bào)錯(cuò)notify-by-email解決

Nagios配置文件的結(jié)構(gòu)

配置Nagios監(jiān)控Oracle服務(wù)器

責(zé)任編輯:zhaolei 來(lái)源: nagiostutorial
相關(guān)推薦

2011-03-25 14:56:43

Nagiosescalations

2011-03-21 15:44:52

escalationsNagios

2011-03-23 13:32:14

Nagios飛信

2011-03-25 13:10:08

2011-03-24 08:56:21

Nagios郵件

2011-03-23 09:07:49

Nagios飛信

2011-03-22 16:31:27

Nagios

2011-03-23 12:55:51

NagiosMSN飛信

2011-03-24 10:08:42

Nagios飛信Linux

2011-03-24 13:00:31

Nagios飛信

2011-03-23 09:07:50

Nagios短信

2011-04-06 14:24:18

2018-12-04 09:02:14

正則表達(dá)式回溯WEB安全

2025-03-05 07:58:30

2011-03-21 15:35:01

Nagiosnagios-plug安裝

2011-03-31 16:05:18

Redhat配置nagios

2011-08-22 12:25:02

nagios

2015-01-05 09:59:42

2010-05-31 09:06:12

Nagios飛信

2011-03-28 15:37:53

nagios作用
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)