nagios3をubuntuにインストールしてみた(その3)

nagiosで遠隔にあるWindows系サーバも監視できる。
それがnrpe_nt というモジュール。
32ビット系なら以下のURLからダウンロード可能。(64ビットとか、いろいろある)
http://sourceforge.jp/projects/sfnet_nrpent/

nrpe_nt.xxxx-binとnrpe_nt_pluginsをダウンロードし展開する。
nrpe.cfg はnrpe_nt_plugins に入ってるのを上書き。
監視するWindowsサーバにフォルダを作り(例えば c:\nrpe)そこに全てのDLL,EXE,CFGを入れる。

  • 【nrpe.cfgの変更例】

# nagiosサーバのIPアドレス
allowed_hosts=192.168.xxx.xxx
# nagiosサーバからの引数も受け付ける
dont_blame_nrpe=1
# exeのパスを合わせ、引数を受け付けるようにコマンドを設定する
command[nt_check_disk_c_arg]=C:\nrpe\diskspace_nrpe_nt.exe c: $ARG1$ $ARG2$
command[nt_check_disk_d_arg]=C:\nrpe\diskspace_nrpe_nt.exe d: $ARG1$ $ARG2$
command[nt_cpuload_arg]=C:\nrpe\cpuload_nrpe_nt.exe $ARG1$ $ARG2$
command[nt_memload_arg]=C:\nrpe\memload_nrpe_nt.exe $ARG1$ $ARG2$

設定が全て終わったら、nrpe_nt.exe -i でWindowsサービスに登録し自動起動に設定。

  • nagiosサーバ側の設定例】

# 引数を渡すことが出来るコマンドを定義しておく
define command{
command_name check_nrpe_arg
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}
# 監視するサービスを定義する
#check_commandが発行されるコマンド, この例では85%でワーニング95%でクリティカル
define service{
host_name saas-server
service_description MEM Check
servicegroups win-server
check_period 24x7
max_check_attempts 5
normal_check_interval 30
retry_check_interval 1
contact_groups cvnet-group
notification_interval 0
notification_period 24x7
notification_options c,r
check_command check_nrpe_arg!nt_memload_arg!'85 95'
}