{"id":701,"date":"2011-06-12T19:17:00","date_gmt":"2011-06-12T19:17:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=701"},"modified":"2022-11-05T10:53:43","modified_gmt":"2022-11-05T10:53:43","slug":"nagios-monitor-https-ssl-certificate-expiry","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=701","title":{"rendered":"Nagios Monitor HTTPS SSL Certificate Expiry"},"content":{"rendered":"\n<p><a href=\"http:\/\/www.google.com\/url?q=http%3A%2F%2Fexchange.nagios.org%2Fdirectory%2FPlugins%2FNetwork-Protocols%2FHTTP%2Fcheck_ssl_cert_alternative%2Fdetails&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFwrFQs8dW5yxHEb2S7GIbUuexcSg\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/exchange.nagios.org\/directory\/Plugins\/Network-Protocols\/HTTP\/check_ssl_cert_alternative\/details<\/a><\/p>\n\n\n\n<p>Downloaded the file and stuck it in: \/usr\/local\/share\/nagios\/libexec<\/p>\n\n\n\n<p>Make it executable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># chmod 755 check_ssl_cert_alternative.pl<\/code><\/pre>\n\n\n\n<p>Change the owner:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># chown nagios check_ssl_cert_alternative.pl<\/code><\/pre>\n\n\n\n<p>Change the group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># chgrp nagios check_ssl_cert_alternative.pl<\/code><\/pre>\n\n\n\n<p>Rename it so I don&#8217;t need to stick the .pl on the end:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mv check_ssl_cert_alternative.pl check_ssl_cert_alternative<\/code><\/pre>\n\n\n\n<p>Do a test run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/check_ssl_cert_alternative -H servername.domain.name:443<\/code><\/pre>\n\n\n\n<p>Seems to be okay we see: &#8220;servername.domain.name:443 68 Days left&#8221;<\/p>\n\n\n\n<p>In the example below, that needs to be added to your nagios config. Setting !30!10, sets the warning at 30 days and the critical at 10 days.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>------------------------------------------------------------------------------------------------------------------------------------\n\nWindowsservers.cfg\n\n------------------------------------------------------------------------------------------------------------------------------------\n\ndefine service{\n\nuse                     generic-service\n\nhost_name               SERVERNAME\n\nservice_description     SSL Cert\n\ncheck_command           check_https!30!10\n\n}\n\n------------------------------------------------------------------------------------------------------------------------------------\n\ncommands.cfg\n\n------------------------------------------------------------------------------------------------------------------------------------\n\ndefine command{\n\ncommand_name    check-ssl-cert\n\ncommand_line    $USER1$\/check_ssl_cert_alternative -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$\n\n}\n\n------------------------------------------------------------------------------------------------------------------------------------<\/code><\/pre>\n\n\n\n<p>Changed this also to give the remaining time as it seemed to be more useful, but also added the time\/date at the end too. This was done by editing the<\/p>\n\n\n\n<p>script itself.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#############################################\n\nprint \"$hoststring $certtimeleft Days left, Expires on: $certenddate \\n\";\n\n#print \"$hoststring expires on $certenddate\\n\";\n\n#############################################<\/code><\/pre>\n\n\n\n<p>You can also set cert expiry warning levels in the script if you don&#8217;t want to pass these arguments via the command string.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/exchange.nagios.org\/directory\/Plugins\/Network-Protocols\/HTTP\/check_ssl_cert_alternative\/details Downloaded the file and stuck it in: \/usr\/local\/share\/nagios\/libexec Make it executable: Change the owner: Change the group: Rename it so I don&#8217;t need to stick the .pl on the end: Do a test run: Seems to be okay we see: &#8220;servername.domain.name:443 68 Days left&#8221; In the example below, that needs to be added to &#8230; <a title=\"Nagios Monitor HTTPS SSL Certificate Expiry\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=701\" aria-label=\"Read more about Nagios Monitor HTTPS SSL Certificate Expiry\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,16],"tags":[],"class_list":["post-701","post","type-post","status-publish","format-standard","hentry","category-linux","category-nagios-and-nagiosxi"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=701"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/701\/revisions"}],"predecessor-version":[{"id":1574,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/701\/revisions\/1574"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}