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

限制Nagios報(bào)警次數(shù)技巧(Escalations)

運(yùn)維 系統(tǒng)運(yùn)維
用Escalations限制Nagios報(bào)警次數(shù):Nagios是一款強(qiáng)大的監(jiān)控工具,特別是他的報(bào)警功能,但是如果服務(wù)器出現(xiàn)故障未及時(shí)解決,那么Nagio就不斷得發(fā)送消息。該通過(guò)怎么樣的方式限制Nagios報(bào)警次數(shù)呢?本文講述的是限制Nagios報(bào)警次數(shù)技巧(Escalations)。

巧用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í)在令人頭疼?,F(xiàn)在用如下方法可以解決Nagios的告警次數(shù)問(wèn)題。

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

  Nagios版本:3.0.6

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

  配置文件內(nèi)容定義:#基本的配置就不再進(jìn)行注釋了。

  1.   hosts.cfg  
  2.  
  3.   define host{  
  4.  
  5.   host_name WWW-Server  
  6.  
  7.   alias WWW-Server  
  8.  
  9.   address 193.1.16.100  
  10.  
  11.   check_command check-host-alive  
  12.  
  13.   max_check_attempts 5  
  14.  
  15.   check_period 24x7  
  16.  
  17.   notification_interval 10  
  18.  
  19.   notification_period 24x7  
  20.  
  21.   notification_options d,u,r  
  22.  
  23.   notifications_enabled 1  
  24.  
  25.   contact_groups chengnan  
  26.  
  27.   }  
  28.  
  29.   Services.cfg  
  30.  
  31.   define service{  
  32.  
  33.   host_name WWW-Server  
  34.  
  35.   service_description Check_HTTP  
  36.  
  37.   check_command check_http  
  38.  
  39.   max_check_attempts 10  
  40.  
  41.   normal_check_interval 3  
  42.  
  43.   retry_check_interval 2  
  44.  
  45.   check_period 24x7  
  46.  
  47.   notification_interval 5  
  48.  
  49.   notification_period 24x7  
  50.  
  51.   notification_options w,u,c,r  
  52.  
  53.   contact_groups admin  
  54.  
  55.   }  
  56.  
  57.   define service{  
  58.  
  59.   host_name WWW-Server  
  60.  
  61.   service_description Check_Jetty  
  62.  
  63.   check_command check_tcp!8080  
  64.  
  65.   max_check_attempts 10  
  66.  
  67.   normal_check_interval 3  
  68.  
  69.   retry_check_interval 2  
  70.  
  71.   check_period 24x7  
  72.  
  73.   notification_interval 5  
  74.  
  75.   notification_period 24x7  
  76.  
  77.   notification_options w,u,c,r  
  78.  
  79.   contact_groups admin  
  80.  
  81.   }  
  82.  
  83.   Contacts.cfg  
  84.  
  85.   define contact{  
  86.  
  87.   contact_name chengnan  
  88.  
  89.   alias chengnan  
  90.  
  91.   service_notification_period 24x7  
  92.  
  93.   host_notification_period 24x7  
  94.  
  95.   service_notification_options w,u,c,r  
  96.  
  97.   host_notification_options d,u,r  
  98.  
  99.   service_notification_commands notify-service-by-email  
  100.  
  101.   host_notification_commands notify-host-by-email  
  102.  
  103.   email chengnan@139.com //手機(jī)郵箱  
  104.  
  105.   }  
  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 24x7  
  8.  
  9.   host_notification_period 24x7  
  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ī)名稱,與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ī)名稱,與Hosts.cfg中一致  
  4.  
  5.   service_description Check_HTTP,Check_Jetty //被監(jiān)控服務(wù)名稱,與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

  1.   vi nagios.cfg  
  2.  

  添加:

  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é)

  escalations這個(gè)功能官方給的定義是notification的擴(kuò)充,使notification變得更加靈活,方便。文中我使用的方法算是耍了個(gè)小聰明,將第四條告警信息后的所有信息全部發(fā)送至我公司郵箱直至服務(wù)器恢復(fù)(recovery的信息還是會(huì)發(fā)送至手機(jī)的),從而實(shí)現(xiàn)限制告警信息發(fā)送至手機(jī)的條數(shù)。這樣,用Escalations限制Nagios報(bào)警次數(shù)的功能就成功實(shí)現(xiàn)了。

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

2011-03-24 08:56:23

escalationsNagios報(bào)警

2011-03-25 14:56:43

Nagiosescalations

2011-03-23 13:32:14

Nagios飛信

2011-03-25 13:10:08

2011-03-24 08:56:21

Nagios郵件

2011-04-01 10:53:43

2013-06-08 16:55:22

Nagios

2011-03-22 16:31:27

Nagios

2011-03-23 09:07:49

Nagios飛信

2011-03-22 14:58:08

Nagios

2011-03-24 10:08:42

Nagios飛信Linux

2011-03-23 12:55:51

NagiosMSN飛信

2011-03-24 13:00:31

Nagios飛信

2011-03-23 09:07:50

Nagios短信

2010-11-09 10:03:26

2011-03-25 15:56:58

2011-04-06 14:24:18

2018-12-04 09:02:14

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

2011-08-22 12:24:56

nagios

2011-08-02 14:39:59

windowsXP系統(tǒng)限制孩子上網(wǎng)
點(diǎn)贊
收藏

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