tomo.gif (1144 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)To previous pageTo home pageMailing to me

Windowsリソース(check_nt)の使い方

Modified: 9 January 2006

ここに使い方の説明があり、参考になりました。
http://cubic9.com/Nagios/%A5%D7%A5%E9%A5%B0%A5%A4%A5%F3/check_nt/


リソース監視エージェントのバージョン番号の取得
起動後の経過時間の取得

CPUの負荷状況の監視
DISKの空き容量の状態監視
メモリの消費状況の監視

特定のサービスの状態の監視
特定のプロセスの状態の監視
特定のファイルの更新状況の監視
スレッド数の監視
サービス数の監視


リソース監視エージェントのバージョン番号の取得

"checkcommands.cfg"

# 'check_nt_version' command definition
define command{
        command_name    check_nt_version
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v CLIENTVERSION
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     Version
        check_command           check_nt_check
        }

CPUの負荷状況の監視

"checkcommands.cfg"

# 'check_nt_cpuload' command definition
define command{
        command_name    check_nt_cpuload
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v CPULOAD -l $ARG1$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     cpuload
        check_command           check_nt_cpuload!10,80,95,60,80,95,1440,80,95
        }

"10,80,95,60,80,95,1440,80,95"は、時間間隔、警告負荷、クリティカル負荷の順に、3つ指定してあります。

最初の "10,80,95"は、時間間隔(10秒)、警告負荷(80%)、クリティカル負荷(95%)を意味します。
次の
"60,80,95"は、時間間隔(60秒=1分)、警告負荷(80%)、クリティカル負荷(95%)を意味します。
最後の "1440,80,95"は、時間間隔(1440秒=1日)、警告負荷(80%)、クリティカル負荷(95%)を意味します。


DISKの空き容量の状態監視

"checkcommands.cfg"

# 'check_nt_disk' command definition
define command{
        command_name    check_nt_disk
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v USEDDISKSPACE -l $ARG1$ -w $ARG2$ -c $ARG3$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     DRIVE-C
        check_command           check_nt_disk!C!80!90
        }

"!C!80!90"は、Cドライブの空き容量が、80%で警告、90%でクリティカルを示します。


起動後の経過時間の取得

"checkcommands.cfg"

# 'check_nt_uptime' command definition
define command{
        command_name    check_nt_uptime
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v UPTIME
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     uptime
        check_command           check_nt_uptime
        }

メモリの消費状況の監視

"checkcommands.cfg"

# 'check_nt_memuse' command definition
define command{
        command_name    check_nt_memuse
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v MEMUSE -w $ARG1$ -c $ARG2$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     memuse
        check_command           check_nt_memuse!80!90
        }

"!80!90"は、メモリが80%で警告、90%でクリティカルを示します。


サービスの状態の監視

"checkcommands.cfg"

# 'check_nt_service' command definition
define command{
        command_name    check_nt_service
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v SERVICESTATE -d SHOWALL -l $ARG1$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     service
        check_command           check_nt_service!NSClient,W3SVC
        }

"!NSClient,W3SVC"は、監視するサービス名をカンマで区切って指定します。

サービス名は、レジストリの"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services "を参照して指定します。


プロセスの状態の監視

"checkcommands.cfg"

# 'check_nt_proc' command definition
define command{
        command_name    check_nt_proc
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v PROCSTATE -d SHOWALL -l $ARG1$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     proc
        check_command           check_nt_proc!Apache.exe
        }

"!Apache.exe"は、監視するプロセス名をカンマで区切って指定します。


ファイルの更新状況の監視

"checkcommands.cfg"

# 'check_nt_fileage' command definition
define command{
        command_name    check_nt_fileage
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v FILEAGE -l $ARG1$ -w $ARG2$ -c $ARE3$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     fileage
        check_command           check_nt_fileage!"C:\\nagios\\nsclient.exe","Date: %d-%m-%Y %I:%M:%S %p"!1440!2880
        }


スレッド数の監視

"checkcommands.cfg"

# 'check_nt_thread' command definition
define command{
        command_name    check_nt_thread
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v COUNTER -l $ARG1$ -w $ARG2$ -c $ARG3$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     Thread
        check_command           check_nt_counter!"\\Process(_Total)\\Thread Count","Thread Count: %.f"!800!900
        }

サービス数の監視

"checkcommands.cfg"

# 'check_nt_session' command definition
define command{
        command_name    check_nt_session
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v COUNTER -l $ARG1$ -w $ARG2$ -c $ARG3$
        }

"services.cfg"

define service{
        use                     generic-service1
        host_name               host
        service_description     Session
        check_command           check_nt_counter!"\\Server\\Server Sessions","Server Sessions: %.f"!20!30
        }

ヘルプを見る

check_nt (nagios-plugins 1.4.2) 1.39
Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)
Copyright (c) 2003-2004 Nagios Plugin Development Team
        <nagiosplug-devel@lists.sourceforge.net>

This plugin collects data from the NSClient service running on a
Windows NT/2000/XP/2003 server.

Usage: check_nt -H host -v variable [-p port] [-w warning] [-c critical]
                [-l params] [-d SHOWALL] [-t timeout]

Options:
-H, --hostname=HOST
  Name of the host to check
-p, --port=INTEGER
  Optional port number (default: 1248)
-s <password>
  Password needed for the request
-w, --warning=INTEGER
  Threshold which will result in a warning status
-c, --critical=INTEGER
  Threshold which will result in a critical status
-t, --timeout=INTEGER
  Seconds before connection attempt times out (default: 10)
-h, --help
  Print this help screen
-V, --version
  Print version information
-v, --variable=STRING
  Variable to check.  Valid variables are:
   CLIENTVERSION = Get the NSClient version
     If -l <version> is specified, will return warning if versions differ.
   CPULOAD = Average CPU load on last x minutes.
     Request a -l parameter with the following syntax:
     -l <minutes range>,<warning threshold>,<critical threshold>.
     <minute range> should be less than 24*60.
     Thresholds are percentage and up to 10 requests can be done in one shot.
     ie: -l 60,90,95,120,90,95
   UPTIME = Get the uptime of the machine.
     No specific parameters. No warning or critical threshold
   USEDDISKSPACE = Size and percentage of disk use.
     Request a -l parameter containing the drive letter only.
     Warning and critical thresholds can be specified with -w and -c.
   MEMUSE = Memory use.
     Warning and critical thresholds can be specified with -w and -c.
   SERVICESTATE = Check the state of one or several services.
     Request a -l parameters with the following syntax:
     -l <service1>,<service2>,<service3>,...
     You can specify -d SHOWALL in case you want to see working services
                 in the returned string.
   PROCSTATE = Check if one or several process are running.
     Same syntax as SERVICESTATE.
   COUNTER = Check any performance counter of Windows NT/2000.
     Request a -l parameters with the following syntax:
                 -l "\\<performance object>\\counter","<description>
     The <description> parameter is optional and 
     is given to a printf output command which requires a float parameter.
     If <description> does not include "%", it is used as a label.
     Some examples:
       "Paging file usage is %.2f %%"
       "%.f %% paging file used."
Notes:
 - The NSClient service should be running on the server to get any information
   (http://nsclient.ready2run.nl).
 - Critical thresholds should be lower than warning thresholds

To previous pageTo home pageMailing to meJump to Top of pageline.gif (927 ツバツイツト)line.gif (927 ツバツイツト)tomo.gif (1144 ツバツイツト)