Nagios check_http plugin
Nagios check_http plugin command usage for reference below.
As mentioned in the command line, check_http plugin tests the HTTP service on the specified host. It can test normal (http) and secure (https) servers, follow redirects, search for strings and regular expressions, check connection times, and report on certificate expiration times.
check_http is useful when you are testing http or https related requests. It is also useful while checking the certificate expiration state.
Common uses are,
To check for certificate validity: ./check_http -H www.middlewareprimer.com -C 14
To check for SSL connection: ./check_http –ssl=1 -H <hostname> -J <private-key> -K <client-cert> -u <URL>
To check for http connection: ./check_http -H www.middlewareprimer.com -f follow -v
Nagios reference link here
As stated in command line,
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.nagios-plugins.org/doc/extra-opts.html
for usage and examples.
-H, –hostname=ADDRESS
Host name argument for servers using host headers (virtual host)
Append a port to include it in the header (eg: example.com:5000)
-I, –IP-address=ADDRESS
IP address or name (use numeric address if possible to bypass DNS lookup).
-p, –port=INTEGER
Port number (default: 80)
-4, –use-ipv4
Use IPv4 connection
-6, –use-ipv6
Use IPv6 connection
-S, –ssl=VERSION
Connect via SSL. Port defaults to 443. VERSION is optional, and prevents
auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).
–sni
Enable SSL/TLS hostname extension support (SNI)
-C, –certificate=INTEGER[,INTEGER]
Minimum number of days a certificate has to be valid. Port defaults to 443
(when this option is used the URL is not checked.)
-J, –client-cert=FILE
Name of file that contains the client certificate (PEM format)
to be used in establishing the SSL session
-K, –private-key=FILE
Name of file containing the private key (PEM format)
matching the client certificate
-e, –expect=STRING
Comma-delimited list of strings, at least one of them is expected in
the first (status) line of the server response (default: HTTP/1.)
If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)
-d, –header-string=STRING
String to expect in the response headers
-s, –string=STRING
String to expect in the content
-u, –url=PATH
URL to GET or POST (default: /)
-P, –post=STRING
URL encoded http POST data
-j, –method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)
Set HTTP method.
-N, –no-body
Don’t wait for document body: stop reading after headers.
(Note that this still does an HTTP GET or POST, not a HEAD.)
-M, –max-age=SECONDS
Warn if document is more than SECONDS old. the number can also be of
the form “10m” for minutes, “10h” for hours, or “10d” for days.
-T, –content-type=STRING
specify Content-Type header media type when POSTing
-l, –linespan
Allow regex to span newlines (must precede -r or -R)
-r, –regex, –ereg=STRING
Search page for regex STRING
-R, –eregi=STRING
Search page for case-insensitive regex STRING
–invert-regex
Return CRITICAL if found, OK if not
-a, –authorization=AUTH_PAIR
Username:password on sites with basic authentication
-b, –proxy-authorization=AUTH_PAIR
Username:password on proxy-servers with basic authentication
-A, –useragent=STRING
String to be sent in http header as “User Agent”
-k, –header=STRING
Any other tags to be sent in http header. Use multiple times for additional headers
-E, –extended-perfdata
Print additional performance data
-L, –link
Wrap output in HTML link (obsoleted by urlize)
-f, –onredirect=<ok|warning|critical|follow|sticky|stickyport>
How to handle redirected pages. sticky is like follow but stick to the
specified IP address. stickyport also ensures port stays the same.
-m, –pagesize=INTEGER<:INTEGER>
Minimum page size required (bytes) : Maximum page size required (bytes)
-w, –warning=DOUBLE
Response time to result in warning status (seconds)
-c, –critical=DOUBLE
Response time to result in critical status (seconds)
-t, –timeout=INTEGER
Seconds before connection times out (default: 10)
-v, –verbose
Show details for command-line debugging (Nagios may truncate output)
