{"id":862,"date":"2016-08-30T10:11:54","date_gmt":"2016-08-30T04:41:54","guid":{"rendered":"http:\/\/www.middlewareprimer.com\/blog\/?p=862"},"modified":"2016-08-30T10:11:54","modified_gmt":"2016-08-30T04:41:54","slug":"nagios-check_http-plugin","status":"publish","type":"post","link":"http:\/\/www.middlewareprimer.com\/blog\/2016\/08\/30\/nagios-check_http-plugin\/","title":{"rendered":"Nagios check_http plugin"},"content":{"rendered":"<p>Nagios check_http plugin command usage for reference below.<\/p>\n<p>As mentioned in the command line, <span style=\"text-decoration: underline;\">check_http plugin<\/span> 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.<\/p>\n<p>check_http is useful when you are testing http or https related requests. It is also useful while checking the certificate expiration state.<\/p>\n<p>Common uses are,<\/p>\n<p>To check for certificate validity: .\/check_http -H www.middlewareprimer.com -C 14<\/p>\n<p>To check for SSL connection: .\/check_http &#8211;ssl=1 -H &lt;hostname&gt; -J &lt;private-key&gt; -K &lt;client-cert&gt; -u &lt;URL&gt;<\/p>\n<p>To check for http connection: .\/check_http -H www.middlewareprimer.com -f follow -v<\/p>\n<p>Nagios reference link <a href=\"https:\/\/assets.nagios.com\/downloads\/nagioscore\/docs\/nagioscore\/3\/en\/monitoring-publicservices.html\" target=\"_blank\"><span style=\"text-decoration: underline;\">here<\/span><\/a><\/p>\n<p>As stated in command line,<\/p>\n<p>Options:<br \/>\n-h, &#8211;help<br \/>\nPrint detailed help screen<br \/>\n-V, &#8211;version<br \/>\nPrint version information<br \/>\n&#8211;extra-opts=[section][@file]<br \/>\nRead options from an ini file. See<br \/>\nhttps:\/\/www.nagios-plugins.org\/doc\/extra-opts.html<br \/>\nfor usage and examples.<br \/>\n-H, &#8211;hostname=ADDRESS<br \/>\nHost name argument for servers using host headers (virtual host)<br \/>\nAppend a port to include it in the header (eg: example.com:5000)<br \/>\n-I, &#8211;IP-address=ADDRESS<br \/>\nIP address or name (use numeric address if possible to bypass DNS lookup).<br \/>\n-p, &#8211;port=INTEGER<br \/>\nPort number (default: 80)<br \/>\n-4, &#8211;use-ipv4<br \/>\nUse IPv4 connection<br \/>\n-6, &#8211;use-ipv6<br \/>\nUse IPv6 connection<br \/>\n-S, &#8211;ssl=VERSION<br \/>\nConnect via SSL. Port defaults to 443. VERSION is optional, and prevents<br \/>\nauto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).<br \/>\n&#8211;sni<br \/>\nEnable SSL\/TLS hostname extension support (SNI)<br \/>\n-C, &#8211;certificate=INTEGER[,INTEGER]<br \/>\nMinimum number of days a certificate has to be valid. Port defaults to 443<br \/>\n(when this option is used the URL is not checked.)<br \/>\n-J, &#8211;client-cert=FILE<br \/>\nName of file that contains the client certificate (PEM format)<br \/>\nto be used in establishing the SSL session<br \/>\n-K, &#8211;private-key=FILE<br \/>\nName of file containing the private key (PEM format)<br \/>\nmatching the client certificate<br \/>\n-e, &#8211;expect=STRING<br \/>\nComma-delimited list of strings, at least one of them is expected in<br \/>\nthe first (status) line of the server response (default: HTTP\/1.)<br \/>\nIf specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)<br \/>\n-d, &#8211;header-string=STRING<br \/>\nString to expect in the response headers<br \/>\n-s, &#8211;string=STRING<br \/>\nString to expect in the content<br \/>\n-u, &#8211;url=PATH<br \/>\nURL to GET or POST (default: \/)<br \/>\n-P, &#8211;post=STRING<br \/>\nURL encoded http POST data<br \/>\n-j, &#8211;method=STRING\u00a0 (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)<br \/>\nSet HTTP method.<br \/>\n-N, &#8211;no-body<br \/>\nDon&#8217;t wait for document body: stop reading after headers.<br \/>\n(Note that this still does an HTTP GET or POST, not a HEAD.)<br \/>\n-M, &#8211;max-age=SECONDS<br \/>\nWarn if document is more than SECONDS old. the number can also be of<br \/>\nthe form &#8220;10m&#8221; for minutes, &#8220;10h&#8221; for hours, or &#8220;10d&#8221; for days.<br \/>\n-T, &#8211;content-type=STRING<br \/>\nspecify Content-Type header media type when POSTing<br \/>\n-l, &#8211;linespan<br \/>\nAllow regex to span newlines (must precede -r or -R)<br \/>\n-r, &#8211;regex, &#8211;ereg=STRING<br \/>\nSearch page for regex STRING<br \/>\n-R, &#8211;eregi=STRING<br \/>\nSearch page for case-insensitive regex STRING<br \/>\n&#8211;invert-regex<br \/>\nReturn CRITICAL if found, OK if not<br \/>\n-a, &#8211;authorization=AUTH_PAIR<br \/>\nUsername:password on sites with basic authentication<br \/>\n-b, &#8211;proxy-authorization=AUTH_PAIR<br \/>\nUsername:password on proxy-servers with basic authentication<br \/>\n-A, &#8211;useragent=STRING<br \/>\nString to be sent in http header as &#8220;User Agent&#8221;<br \/>\n-k, &#8211;header=STRING<br \/>\nAny other tags to be sent in http header. Use multiple times for additional headers<br \/>\n-E, &#8211;extended-perfdata<br \/>\nPrint additional performance data<br \/>\n-L, &#8211;link<br \/>\nWrap output in HTML link (obsoleted by urlize)<br \/>\n-f, &#8211;onredirect=&lt;ok|warning|critical|follow|sticky|stickyport&gt;<br \/>\nHow to handle redirected pages. sticky is like follow but stick to the<br \/>\nspecified IP address. stickyport also ensures port stays the same.<br \/>\n-m, &#8211;pagesize=INTEGER&lt;:INTEGER&gt;<br \/>\nMinimum page size required (bytes) : Maximum page size required (bytes)<br \/>\n-w, &#8211;warning=DOUBLE<br \/>\nResponse time to result in warning status (seconds)<br \/>\n-c, &#8211;critical=DOUBLE<br \/>\nResponse time to result in critical status (seconds)<br \/>\n-t, &#8211;timeout=INTEGER<br \/>\nSeconds before connection times out (default: 10)<br \/>\n-v, &#8211;verbose<br \/>\nShow details for command-line debugging (Nagios may truncate output)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[153],"tags":[119,255,156],"class_list":["post-862","post","type-post","status-publish","format-standard","hentry","category-nagios","tag-check_http","tag-nagios-check_http-plugin","tag-nagios-xi"],"_links":{"self":[{"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/posts\/862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/comments?post=862"}],"version-history":[{"count":1,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/posts\/862\/revisions"}],"predecessor-version":[{"id":865,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/posts\/862\/revisions\/865"}],"wp:attachment":[{"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/media?parent=862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/categories?post=862"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.middlewareprimer.com\/blog\/wp-json\/wp\/v2\/tags?post=862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}