Built in command
Check_NT

check_nt v2.2.git (monitoring-plugins 2.2)
Copyright (c) 2000 Yves Rubin ([email protected])
Copyright (c) 2000-2007 Monitoring Plugins Development Team
    <[email protected]>

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] [-u] [-t timeout]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.monitoring-plugins.org/doc/extra-opts.html
    for usage and examples.
Options:
 -H, --hostname=HOST
   Name of the host to check
 -p, --port=INTEGER
   Optional port number (default: 1248)
 -s, --secret=<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:  -l, --params=<parameters>
   Parameters passed to specified check (see below) -d, --display={SHOWALL}
   Display options (currently only SHOWALL works) -u, --unknown-timeout
   Return UNKNOWN on timeouts10)
 -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.
  -l <unit> 
  <unit> = seconds, minutes, hours, or days. (default: minutes)
  Thresholds will use the unit specified above.
 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."
 INSTANCES =
  Check any performance counter object of Windows NT/2000.
  Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>
  <counter object> is a Windows Perfmon Counter object (eg. Process),
  if it is two words, it should be enclosed in quotes
  The returned results will be a comma-separated list of instances on 
   the selected computer for that object.
  The purpose of this is to be run from command line to determine what instances
   are available for monitoring without having to log onto the Windows server
    to run Perfmon directly.
  It can also be used in scripts that automatically create the monitoring service
   configuration files.
  Some examples:
  check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process

Show a drive usage, we take C drive as example:

check_nt!USEDDISKSPACE! -l c -w 80 -c 90

to check other drive, simply change the “c” after the -l into the drive letter you want to check.

check_nt can check the local drive, if you want to check the network drive, such as NAS, you can use the check_disk_smb, which is talked about below.

Third party plugin

Such as the check_disk_smb, there is no command defined as this. You need to define the command and arguments first, then use it in the host configuration file.

 Commands that can be defined include service checks, service notifications, service event handlers, host checks, host notifications, and host event handlers. Command definitions can contain macros, but you must make sure that you include only those macros that are “valid” for the circumstances when the command will be used. More information on what macros are available and when they are “valid” can be found here. The different arguments to a command definition are outlined below.

Definition Format:

Note: Directives in red are required, while those in black are optional.

define command{
command_name command_name
command_line command_line
}
check_disk_smb

Example Definition:

define command{
        command_name    check_disk_smb
        command_line    $USER1$/check_disk_smb -H $ARG1$ -s $ARG2$ -w $ARG3$ -c $ARG4$
        }

If I want to check the free space of the smb share located on 192.168.90.202 (NAS box), and the shared volume is “Data” , and the Windows client (win2012Svr) mapped the smb share as a drive Z:.   Then in the windows Server host configuration file(windowscfg).define the service as follow:

define service{
        use                     generic-service
        host_name               win2012Svr
        service_description     z:\ Diskstation Space
        check_command           check_disk_smb!192.168.90.202!Data!75!90
        }

smbshare

Directive Descriptions:

command_name: This directive is the short name used to identify the command. It is referenced in contact, host, and service definitions (in notification, check, and event handler directives), among other places.
command_line: This directive is used to define what is actually executed by Nagios when the command is used for service or host checks, notifications, or event handlers. Before the command line is executed, all valid macros are replaced with their respective values. See the documentation on macros for determining when you can use different macros. Note that the command line is not surrounded in quotes. Also, if you want to pass a dollar sign ($) on the command line, you have to escape it with another dollar sign.

NOTE: You may not include a semicolon (;) in the command_line directive, because everything after it will be ignored as a config file comment. You can work around this limitation by setting one of the $USER$ macros in your resource file to a semicolon and then referencing the appropriate $USER$ macro in the command_line directive in place of the semicolon.

If you want to pass arguments to commands during runtime, you can use $ARGn$ macros in the command_line directive of the command definition and then separate individual arguments from the command name (and from each other) using bang (!) characters in the object definition directive (host check command, service event handler command, etc) that references the command. More information on how arguments in command definitions are processed during runtime can be found in the documentation on macros.

Error in check_http

To check the http status:

/usr/local/nagios/libexec/check_http -H 192.168.90.55

Error message:

SERVICE ALERT: nagios-linuxclient;HTTP;WARNING;HARD;4;HTTP WARNING: HTTP/1.1 403 Forbidden – 5168 bytes in 0.077 second response time

Reason: the /var/www/html/ directory is empty, try the following command:

$ touch /var/www/html/index.html
$ chmod 755 /var/www/html/index.html
Reference

Check_disk_smb: https://www.monitoring-plugins.org/doc/man/check_disk_smb.html