標籤:nagios配置 nagios監控windows
1.1 windows用戶端安裝 NSClient++
注意:安裝後中會有提示允許那些主機listen,添加nagios-server主機。安裝完後會提供一個密碼,記得儲存,server端會用到。
1.2 啟用nagios.cfg中的 cfg_file=/usr/local/nagios/etc/objects/windows.cfg,如果需要監控多台Windows主機,建議啟用cfg_dir==/usr/local/nagios/etc/windows
1.3 配置templates.cfg,添加如下內容
#windows host
define host{
name Windows ; 模板主機名稱(可以自己定義),供後面windows.cfg調用
use generic-host ; Inherit default values from the generic-host template
check_period 24x7 ; 檢查周期,也可以設定成其它的,例如workhours,具體的可以在/usr/local/nagios/etc/object/timeperiod裡面定義
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are "alive"
notification_period 24x7 ; 發送警示時間段,就是什麼時間可以發送警示給管理員,與check_period一樣自定
notification_interval 30 ; 警示發送周期,這裡預設是分鐘單位,30的意思是每30分鐘發送一次警示
notification_options d,r ; 需要發送警示的層級,就是當發生什麼事件時警示,d表示down,r表示recovery
contact_groups admins ; 聯絡使用者組,就是將警示發送給哪個Administrator 群組
hostgroups windows ; 主機群組名(可以自己定義):
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
}
#windows service
define service{
name windows-service ; 模板服務名稱
active_checks_enabled 1 ; 啟用檢查,1表示啟用,0表示不啟用
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ;關注該服務
check_freshness 0 ; Default is to NOT check service ‘freshness‘
notifications_enabled 1 ; 允許提醒
event_handler_enabled 1 ; 啟用事件處理常式
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; 效能資料
retain_status_information 1 ; 保留狀態資訊
retain_nonstatus_information 1 ; 保留非狀態資訊
is_volatile 0 ; 服務是否穩定,1表示穩定,0表示不穩定
check_period workhours ; 檢查周期
max_check_attempts 3 ; 重新檢查該服務3次,以確定其最終狀態
normal_check_interval 10 ; 在正常情況下,每10分鐘檢查一個服務
retry_check_interval 2 ; 每2分鐘重新檢查一次,直到一個異常的狀態可以被確定
contact_groups admins ; 聯絡組
notification_options w,u,c,r ; 警示層級warning, unknown, critical,recovery
notification_interval 60 ; 發送警示的周期
notification_period workhours ; 發送警示的時間段
register 0
}
1.4 配置windows.cfg
define host{
use Windows ; 這裡調用的templates.cfg中配置的主機模板
host_name PC-1 ; 主機名稱
alias Test 1 ; 主機別名
address 192.168.1.3 ; 主機IP
}
define hostgroup{
hostgroup_name windows ; 主機所屬組
alias Windows Cline ; 組別名
members PC-1 ;群組成員
}
define service{
use windows-service ;調用templates中service的模板
host_name PC-1 ;應用於哪台主機,如果有多台,用逗號隔開
service_description NSClient++ Version ;服務描素,這裡的會顯示在網頁中
check_command check_nt!CLIENTVERSION -s password ;password就是SClient++的密碼
}
define service{
use windows-service
host_name PC-1
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 90 -c 99 -s password ;-l後面跟隨的是磁碟符
}
本文出自 “楊路的Linux文章” 部落格,請務必保留此出處http://yanglulinux.blog.51cto.com/2809000/1684576
Nagios配置之Windows