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

Nagios的配置過程

運(yùn)維 系統(tǒng)運(yùn)維
Nagios的配置過程:Nagios的功能是監(jiān)控服務(wù)和主機(jī),根據(jù)配置在服務(wù)器異常的時(shí)候提供報(bào)警功能,并提供友好的WEB界面查看當(dāng)前的網(wǎng)絡(luò)狀態(tài)、通知和故障歷史、日志文件…但是他自身并不包括這部分功能的代碼,所有的監(jiān)控、檢測(cè)功能都是有插件來完成的。本文講述的是Nagios的配置過程

  Nagios配置過程:

  nagios的主要配置文件包括

  nagios.cfg //主配置文件

  contacts.cfg //聯(lián)系人配置文件

  contactgroups.cfg //聯(lián)系人組配置文件

  commands.cfg //命令配置文件

  host.cfg //主機(jī)配置文件

  hostgroups.cfg //服務(wù)器組文件

  templates.cfg //模板文件

  timeperiods.cfg //監(jiān)視時(shí)段文件

  services.cfg //服務(wù)配置文件

  主配置文件 nagios.cfg 需要更改的地方:

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

  interval_length=1 ; 間隔時(shí)間基準(zhǔn)由 60s 改為 1s

  command_check_interval=10s ; 命令檢查時(shí)間間隔,-1 表示盡可能頻繁的進(jìn)行檢查

  date_format=iso8601 ; 日期格式

  objects/contacts.cfg 用來定義聯(lián)系人:

  1.   define contact { contact_name sa alias System Administrator service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email admin@test.com }  
  2.  

  再定義聯(lián)系人組

  1.   define contactgroup { contactgroup_name admins alias Administrator Group members sa ; 添加其它聯(lián)系人用 "," 分隔 }  
  2.  

  主機(jī)監(jiān)控的配置

  1.   define host {  
  2.  
  3.   host_name host_name ; 簡短的主機(jī)名稱。  
  4.  
  5.   alias alias ; 別名,可以更詳細(xì)的說明主機(jī)。  
  6.  
  7.   address address ; IP 地址,也可以寫主機(jī)名。如果不定義這個(gè)值, nagio 將會(huì)用 host_name 去尋找主機(jī)。  
  8.  
  9.   parents host_names ; 上一節(jié)點(diǎn)的名稱,也就是指從 nagios 服務(wù)器到被監(jiān)控主機(jī)之間經(jīng)過的節(jié)點(diǎn),可以是路由器、交換機(jī)、主機(jī)等等。  
  10.  
  11.   hostgroups hostgroup_names ; 簡短的主機(jī)組名稱。  
  12.  
  13.   check_command command_name ; 檢查命令的簡短名稱,如果此項(xiàng)留空, nagios 將不會(huì)去判斷主機(jī)是否 alive 。  
  14.  
  15.   max_check_attempts 整數(shù) ; 當(dāng)檢查命令的返回值不是 "OK" 時(shí),重試的次數(shù)。  
  16.  
  17.   check_interval 數(shù)字 ; 循環(huán)檢查的間隔時(shí)間。  
  18.  
  19.   active_checks_enabled [0/1] ; 是否啟用 "active_checks"  
  20.  
  21.   passive_checks_enabled [0/1] ; 是否啟用 "passive_checks" ,及“被動(dòng)檢查”  
  22.  
  23.   check_period timeperiod_name ; 檢測(cè)時(shí)間段簡短名稱,這只是個(gè)名稱,具體的時(shí)間段要寫在其他的配置文件中。  
  24.  
  25.   obsess_over_host [0/1] ; 是否啟用主機(jī)操作系統(tǒng)探測(cè)。  
  26.  
  27.   check_freshness [0/1] ; 是否啟用 freshness 檢查。freshness 檢查是對(duì)于啟用被動(dòng)檢查模式的主機(jī)而言的,其作用是定期檢查主機(jī)報(bào)告的狀態(tài)信息,如果該狀態(tài)信息已經(jīng)過期,freshness 將會(huì)強(qiáng)制做主機(jī)檢查。  
  28.  
  29.   freshness_threshold 數(shù)字 ; fressness 的臨界值,單位為秒。 如果定義為 "0" ,則為自動(dòng)定義。  
  30.  
  31.   event_handler command_name ; 當(dāng)主機(jī)發(fā)生狀態(tài)改變時(shí),采用的處理命令的簡短的名字(可以在 commands.cfg 中對(duì)其定義)  
  32.  
  33.   event_handler_enabled [0/1] ; 是否啟用 event_handler  
  34.  
  35.   low_flap_threshold 數(shù)字 ; 抖動(dòng)的下限值。抖動(dòng),即在一段時(shí)間內(nèi),主機(jī)(或服務(wù))的狀態(tài)值頻繁的發(fā)生變化。  
  36.  
  37.   high_flap_threshold 數(shù)字 ; 抖動(dòng)的上限值。  
  38.  
  39.   flap_detection_enabled [0/1] ; 是否啟用抖動(dòng)檢查。  
  40.  
  41.   process_perf_data [0/1] ; 是否啟用 processing of performance data  
  42.  
  43.   retain_status_information [0/1] ; 程序重啟時(shí),是否保持主機(jī)狀態(tài)相關(guān)的信息。  
  44.  
  45.   retain_nonstatus_information [0/1] ; 程序重啟時(shí),是否保持主機(jī)狀態(tài)無關(guān)的信息。  
  46.  
  47.   contact_groups contact_groups ; 聯(lián)系人組,在此組中的聯(lián)系人都會(huì)收到主機(jī)的提醒信息。  
  48.  
  49.   notification_interval 整數(shù) ; 重復(fù)發(fā)送提醒信息的最短間隔時(shí)間。默認(rèn)間隔時(shí)間是 "60" 分鐘。如果這個(gè)值設(shè)置為 "0" ,將不會(huì)發(fā)送重復(fù)提醒。  
  50.  
  51.   notification_period timeperiod_name ; 發(fā)送提醒的時(shí)間段。非常重要的主機(jī)(服務(wù))定義為 24x7 ,一般的主機(jī)(服務(wù))就定義為上班時(shí)間。如果不在定義的時(shí)間段內(nèi),無論發(fā)生什么問題,都不會(huì)發(fā)送提醒。  
  52.  
  53.   notification_options [d,u,r,f] ; 發(fā)送提醒包括的情況: d = 狀態(tài)為 DOWN , u = 狀態(tài)為 UNREACHABLE , r = 狀態(tài)恢復(fù)為 OK , f = flapping 
  54.  
  55.   notifications_enabled [0/1] ; 是否開啟提醒功能。"1" 為開啟,"0" 為禁用。一般,這個(gè)選項(xiàng)會(huì)在主配置文件 (nagios.cfg) 中定義,效果相同。  
  56.  
  57.   stalking_options [o,d,u] ; 持續(xù)狀態(tài)檢測(cè)參數(shù),o = 持續(xù)的 UP 狀態(tài) , d = 持續(xù)的 DOWN 狀態(tài) , u = 持續(xù)的 UNREACHABLE 狀態(tài)  
  58.  
  59.   }  
  60.  

  服務(wù)監(jiān)控的配置

  1.   define contact { contact_name sa alias System Administrator service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email admin@test.com }  
  2.  

  服務(wù)監(jiān)控的配置和主機(jī)監(jiān)控的配置較為相似,就不一一說明了。

  間隔時(shí)間的計(jì)算方法為:

  1.   normal_check_interval x interval_length 秒  
  2.  
  3.   retry_check_interval x interval_length 秒  
  4.  
  5.   notification_interval x interval_length 秒  
  6.  

  主機(jī)監(jiān)控配置的例子

  1.   define host { host_name web1 alias web1 address 192.168.0.101 contact_groups admins check_command check-host-alive max_check_attempts 5 notification_interval 0 notification_period 24x7 notification_options d,u,r }  
  2.  

  對(duì)主機(jī) web1 進(jìn)行 24x7 的監(jiān)控,默認(rèn)會(huì)每 10 秒檢查一次狀態(tài),累計(jì)五次失敗就發(fā)送提醒,并且不再重復(fù)發(fā)送提醒。

  服務(wù)監(jiān)控配置的例子

  1.   define service { host_name web1 service_description check_http check_period 24x7 max_check_attempts 3 normal_check_interval 30 contact_groups admins retry_check_interval 15 notification_interval 3600 notification_period 24x7 notification_options w,u,c,r check_command check_http }  
  2.  

  配置解釋: 24x7 監(jiān)控 web1 主機(jī)上的 HTTP 服務(wù),檢查間隔為 30 秒, 檢查失敗后每 15 秒再進(jìn)行一次檢查,累計(jì)三次失敗就認(rèn)定是故障并發(fā)送提醒。

  聯(lián)系人組是 admins 。提醒后恢復(fù)到 30 秒一次的 normal_check_interval 檢查。如果服務(wù)仍然沒有被恢復(fù),每個(gè)小時(shí)發(fā)送一次提醒。

  如果要檢測(cè)其他服務(wù),例如,要檢查 ssh 服務(wù)是否開啟,更改如下兩行:

  1.   service_description check_ssh  
  2.  
  3.   check_command check_ssh  
  4.  

  為方便管理,對(duì)配置文件的分布做了如下修改:

  nagios.cfg 中增加了:

  1.   cfg_dir=/usr/local/nagios/etc/hosts  
  2.  
  3.   cfg_dir=/usr/local/nagios/etc/services  
  4.  

  在 hosts 目錄中,為不同類型的主機(jī)創(chuàng)建了配置文件,如: app.cfg cache.cfg mysql.cfg web.cfg

  并創(chuàng)建了 hostgroup.cfg 文件對(duì)主機(jī)進(jìn)行分組,如:

  1.   define hostgroup { hostgroup_name app-hosts alias APP Hosts members app1,app2 }  
  2.  

  在 services 目錄中創(chuàng)建了各種服務(wù)的配置文件,如: disk.cfg http.cfg load.cfg mysql.cfg

  并創(chuàng)建了 servicegroup.cfg 文件對(duì)服務(wù)進(jìn)行分組,如:

  1.   define servicegroup { servicegroup_name disk alias DISK members cache1,check_disk,cache2,check_disk  

【編輯推薦】

使用nagios監(jiān)控oracle

啟動(dòng)Nagios服務(wù)

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

責(zé)任編輯:zhaolei 來源: CSDN
相關(guān)推薦

2011-03-21 09:17:06

Nagios

2011-03-28 12:42:26

nagios

2011-03-28 11:03:09

配置Nagios

2011-03-31 16:05:18

Redhat配置nagios

2011-08-22 12:25:02

nagios

2011-03-25 17:13:37

Nagios配置文件

2011-03-28 13:57:57

2010-05-31 11:10:37

Nagios pnp

2011-03-25 17:35:12

SuseNagios

2011-03-22 13:37:29

Nagios安裝

2010-05-31 10:00:14

Nagios安裝

2011-11-08 21:58:01

Nagios 配置 流

2011-03-25 16:49:33

nagios服務(wù)

2011-03-25 10:37:17

2011-03-23 13:29:46

配置Nagios系統(tǒng)

2011-03-24 13:00:30

2011-03-23 15:13:08

Nagios配置文件

2011-03-28 15:22:00

nagios

2010-05-31 10:22:31

Nagios pnp

2011-03-23 14:43:10

Nagiosnagios.cfg
點(diǎn)贊
收藏

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