Page 1 of 1

Notes, Notes_URL, Action_URL are not visible in Nagios XI

Posted: Tue Nov 17, 2015 10:31 am
by mopp
Hello,

this is a feature request. The information Notes, Notes_URL, Action_URL are not shown in Nagios XI. But these are really useful, e. g. Notes_URL could point to a documentation how to fix a problem or some hints are stored in the Notes.
I would expect to see the Notes_URL and Action_URL in the "Quick Actions" box and the notes in the "Advanced Status Details".

As an alternative I created a small patch for the freevariables component to show these values:

Code: Select all

--- freevariabletab.inc.php.orig        2015-09-30 09:23:48.749092576 +0200
+++ freevariabletab.inc.php     2015-11-17 16:19:18.029801448 +0100
@@ -35,7 +35,7 @@
                COMPONENT_AUTHOR => "Nagios Enterprises, LLC",
                COMPONENT_DESCRIPTION => _("Adds a new tabs on host and service detail screens to show free variables from config.  ").$desc,
                COMPONENT_TITLE => "Free Variable Tab",
-        COMPONENT_VERSION => '1.0.1',
+        COMPONENT_VERSION => '1.1.0',

                // configuration function (optional)
                //COMPONENT_CONFIGFUNCTION => "freevariabletab_component_config_func",
@@ -77,7 +77,22 @@
        $hostname=grab_array_var($cbdata,"host");
        $servicename=grab_array_var($cbdata,"service");

-       $content='<div class="infotable_title">Free Variables</div>';
+       $content='<div class="infotable_title">Misc Settings</div>';
+
+       $freemiscsettings=freevariabletab_component_get_miscsettings($hostname,$servicename);
+
+    if($freemiscsettings){
+        $content.='<table class="table table-bordered table-striped" style="max-width: 800px;"><tr><th style="width: 200px;">Name</th><th>Value</th></tr>';
+
+        if (!empty($freemiscsettings->notes)) $content.='<tr><td>Notes</td><td>'.$freemiscsettings->notes.'</td></tr>';
+        if (!empty($freemiscsettings->notes_url)) $content.='<tr><td>Notes URL</td><td><a href="'.$freemiscsettings->notes_url.'">'.$freemiscsettings->notes_url.'</a></td></tr>';
+        if (!empty($freemiscsettings->action_url)) $content.='<tr><td>Action URL</td><td><a href="'.$freemiscsettings->action_url.'">'.$freemiscsettings->action_url.'</a></td></tr>';
+
+        $content.='</table>';
+
+    }
+
+       $content.='<div class="infotable_title">Free Variables</div>';

        $freevariables=freevariabletab_component_get_freevariables($hostname,$servicename);

@@ -104,6 +119,25 @@
        $cbdata["tabs"][]=$newtab;
        }

+function freevariabletab_component_get_miscsettings($hostname,$servicename=null){
+
+       $args=array(
+               "host_name" => $hostname
+               );
+    if(!$servicename){
+        $x=get_xml_host_objects($args);
+        if($x->host)
+            return $x->host;
+    } else {
+        $args["service_description"] = $servicename;
+        $x=get_xml_service_objects($args);
+        if($x->service)
+            return $x->service;
+    }
+
+       return false;
+       }
+

 function freevariabletab_component_get_freevariables($hostname,$servicename=null){

@@ -126,4 +160,4 @@



-?>
\ No newline at end of file
+?>

Re: Notes, Notes_URL, Action_URL are not visible in Nagios X

Posted: Tue Nov 17, 2015 11:32 am
by tmcdonald
I could have sworn that was in there, might only be in the Core interface. I'll talk to the devs about adding this in.

Re: Notes, Notes_URL, Action_URL are not visible in Nagios X

Posted: Tue Nov 17, 2015 5:39 pm
by mopp
You can see the data in the core interface, but the core interface looks totally different and you get a lot of information in a different view you already see in the XI interface.
It would be helpful to have this information in the XI interface. Or you update the freevariables component using my patch, of course you can enhance it further. It is just a proof of concept.

Re: Notes, Notes_URL, Action_URL are not visible in Nagios X

Posted: Wed Nov 18, 2015 1:49 pm
by tmcdonald
We'll put in the feature request and let the devs take it from there. Thanks for the patch!

Mind if we close this up?

Re: Notes, Notes_URL, Action_URL are not visible in Nagios X

Posted: Wed Nov 18, 2015 4:44 pm
by mopp
You can close this thread

Re: Notes, Notes_URL, Action_URL are not visible in Nagios X

Posted: Wed Nov 18, 2015 4:47 pm
by rkennedy
Sounds good. I have filed the feature request, ID 7253. I will now close this thread, feel free to open another thread if you ever need assistance in the future.