Nagios Ping Tool – Another Hack

I’ve received a patch from ed.davison, if you have commented out hosts in your config, you’ll get odd \”address – hostname\” results in the drop down list. Ed’s patch fixes that; thankx :-D

At the moment you’d have to apply the patch your self from the below; but I have a official revision in the pipeline.

-- readhosts.php       2005/11/09 18:07:43     1.1
+++ readhosts.php       2005/11/09 18:08:12
@@ -23,16 +23,20 @@

       $current = trim($line);

-       if (preg_match (\"/addres/\", \"$current\")) {
-               $keywords = preg_split (\"/[\\s,]+/\", \"$current\");
-               $ipaddress[$counter] = $keywords[1];
-               $counter++;
-       }
-
-       if (preg_match (\"/host_name/\", \"$current\")) {
-               $keywords = preg_split (\"/[\\s,]+/\", \"$current\");
-               $node_name[$counter2] = $keywords[1];
-               $counter2++;
+       if (!preg_match (\"/^#/\", \"$current\")) {
+
+               if (preg_match (\"/addres/\", \"$current\")) {
+                       $keywords = preg_split (\"/[\\s,]+/\", \"$current\");
+                       $ipaddress[$counter] = $keywords[1];
+                       $counter++;
+               }
+
+               if (preg_match (\"/host_name/\", \"$current\")) {
+                       $keywords = preg_split (\"/[\\s,]+/\", \"$current\");
+                       $node_name[$counter2] = $keywords[1];
+                       $counter2++;
+               }
+
       }

rgds,

Nick


2 thoughts on “Nagios Ping Tool – Another Hack

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>