{"id":32,"date":"2012-11-20T12:58:31","date_gmt":"2012-11-20T12:58:31","guid":{"rendered":"https:\/\/anthonyparkes.co.uk\/?page_id=32"},"modified":"2021-11-21T13:45:33","modified_gmt":"2021-11-21T13:45:33","slug":"internet-storm-center-infocon-status-in-nagios","status":"publish","type":"page","link":"https:\/\/anthonyparkes.co.uk\/?page_id=32","title":{"rendered":"Internet Storm Center Infocon Status in Nagios"},"content":{"rendered":"<p>Save the following script in your libexec folder in nagios<\/p>\n<pre>&lt;?php\n$fp = fsockopen(\"isc.sans.org\", 80, $errno, $errstr, 30);\nif (!$fp) {\necho \"Infocon Security Status: $data\"; exit(3);\n} else {\n$out = \"GET \/infocon.txt HTTP\/1.1\\r\\n\";\n$out .= \"Host: isc.sans.org\\r\\n\";\n$out .= \"Connection: Close\\r\\n\\r\\n\";\nfwrite($fp, $out);\nwhile (!feof($fp)) {\n$data = fgets($fp, 128);\n}\nfclose($fp);\n}\nif ($data == \"green\") { echo \"Infocon Security Status: $data\"; exit(0); }\nif ($data == \"yellow\") { echo \"Infocon Security Status: $data\"; exit(1); }\nif ($data == \"orange\") { echo \"Infocon Security Status: $data\"; exit(2); }\nif ($data == \"red\") { echo \"Infocon Security Status: $data\"; exit(2); }\n?&gt;<\/pre>\n<p>Then add the following to your\u00a0commands.cfg<\/p>\n<p>define command{<br \/>\ncommand_name \u00a0 \u00a0check_sans<br \/>\ncommand_line \u00a0 \u00a0php $USER1$\/check_sans.php<br \/>\n}<\/p>\n<p>you can then add the command to your nagios. if the current status is green then nagios will report OK. If its yellow it will report Warning and if Orange or Red nagios will report Critical.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Save the following script in your libexec folder in nagios &lt;?php $fp = fsockopen(&#8220;isc.sans.org&#8221;, 80, $errno, $errstr, 30); if (!$fp) { echo &#8220;Infocon Security Status:<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-fullwidth.php","meta":{"footnotes":""},"class_list":["post-32","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":2,"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/32\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/32\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/anthonyparkes.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}