check_nt
WindowsのNSClientサービスを使って、様々な値をチェックするプラグイン。
主なものは下記。
- NSClientのバージョン
- CPU負荷
- 稼働時間
- ディスク使用量
- メモリ使用量
- サービスの状態
- プロセスの状態
- ファイルの更新日時から現在までの経過分数
- パフォーマンスカウンタの値
対象
リモート
アーカイブ内での位置
plugins/check_nt
必要なもの
対象ホストに下記が必要
実行
Cドライブの使用容量が 80% で WARNING、 90% で CRITICAL。
/usr/local/nagios/libexec/check_nt -H 192.168.0.2 -v USEDDISKSPACE -l C -w 80 -c 90
ここで、OK, CRITICAL等は表示されないが、ちゃんと終了コードはOK, CRITICALの値をとっているので、
Nagiosに設定するか、下記を実行すれば結果が分かる。
echo $?0
| 終了コード | 結果 |
| -1 | UNKNOWN |
| 0 | OK |
| 1 | WARNING |
| 2 | CRITICAL |
checkcommands.cfgでの定義
# 'check_nt' command definition
define command{
command_name check_nt_clientversion
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v CLIENTVERSION
}
define command{
command_name check_nt_cpuload
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v CPULOAD -l $ARG1$
}
define command{
command_name check_nt_uptime
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v UPTIME
}
define command{
command_name check_nt_disk
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v USEDDISKSPACE -l $ARG1$ -w $ARG2$ -c $ARG3$
}
define command{
command_name check_nt_memuse
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v MEMUSE -w $ARG1$ -c $ARG2$
}
define command{
command_name check_nt_service
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v SERVICESTATE -l $ARG1$
}
define command{
command_name check_nt_process
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v PROCSTATE -l $ARG1$
}
define command{
command_name check_nt_fileage
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v FILEAGE -l $ARG1$ -w $ARG2$ -c $ARG3$
}
define command{
command_name check_nt_counter
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v COUNTER -l $ARG1$ -w $ARG2$ -c $ARG3$
}
注:check_nt_fileage の c, w のとる値は最終更新日時からの分数
サービスの定義
define service{
use generic-service
host_name hoge
service_description NT_CLIENTVERSION
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_clientversion
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_CPULOAD
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_cpuload!5,80,90
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_UPTIME
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_uptime
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_DISK C
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_disk!C!80!90
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_MEMUSE
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_memuse!80!90
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_SERVICE
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_service!NSClient,Dnscache
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_PROCESS
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_process!explorer.exe,imejpmgr.exe
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_FILEAGE boot.ini
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_fileage!"c:\\boot.ini"!30!60
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_COUNTER Paging file
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_counter!"\\Paging File(_Total)\\%% Usage","Paging file usage is %.2f %%"!80!90
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_COUNTER Thread Count
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_counter!"\\Process(_Total)\\Thread Count","Thread Count: %.f"!600!800
contact_groups linux-admins
}
define service{
use generic-service
host_name hoge
service_description NT_COUNTER Server Sessions
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_nt_counter!"\\Server\\Server Sessions","Server Sessions: %.f"!20!30
contact_groups linux-admins
}
備考
個人的には同様のチェックはNRPE_NTで行うのがお勧めです。


