Page 1 of 1

Add notes to host status page

Posted: Wed Jan 22, 2014 10:55 am
by phobbs
Most of my hosts have some additional information defined in the notes field.
Currently, the only way to see that information in Nagios XI from the host status page is to open the Advanced tab and click "See this host in Nagios Core".
What I'd like to see is an option to have that displayed underneath the host name and alias on the status page.
I've already developed a patch to do it, but I need to re-install it after every upgrade so it would be nice if this could be included in a future version.

Patch against Nagios XI 2012R2.8c

Code: Select all

729a730,736
>
>       // Get notes for host status page
>         $backendargs = array('host_id' => $host_id);
>         $func = "get_xml_host_objects";
>         $notexml = $func($backendargs);
>         foreach($notexml->host as $obj)
>                 $note = strval($obj->notes);
741a749
>       <?php if ($note != "") { echo "<br/><div>$note</div>"; } ?>
1611c1619
< ?>
\ No newline at end of file
---
> ?>

Re: Add notes to host status page

Posted: Thu Jan 23, 2014 1:52 pm
by slansing
Ah, so you are looking for a button that will drop down beneath the host and show it's notes? That's a pretty neat idea. Have you considered opening a feature request for this at:

tracker.nagios.com

Re: Add notes to host status page

Posted: Fri Jan 24, 2014 9:27 am
by phobbs
Not exactly, it's just the notes text, not a button.
Here's a screenshot of what it looks like, the part circled in red is the note.
Image

Thanks for the suggestion, I'll check out the tracker.

Re: Add notes to host status page

Posted: Mon Feb 23, 2015 10:23 am
by yabonio
PHOBBS: Can i ask you where to put your patch?

i'm really interested on it.

Thank you.

Re: Add notes to host status page

Posted: Mon Feb 23, 2015 10:40 am
by tmcdonald
We can leave this thread open, but I am almost certain that phobbs will not be returning as it has been over a year since this thread was last active.

However, that looks like /usr/local/nagiosxi/html/includes/components/xicore/status-object-detail.inc.php though the patch may not work on later versions as the code has likely changed a bit since then.

Re: Add notes to host status page

Posted: Tue May 26, 2015 3:42 pm
by krutaw
I just tested it with version 2014R2.7 and it indeed works. Here's how to do it:


edit /usr/local/nagiosxi/html/includes/components/xicore/status-object-detail.inc.php and put the following at line 756: (just after $hostalias = $xml->hoststatus->alias;)
// Get notes for host status page
$backendargs = array('host_id' => $host_id);
$func = "get_xml_host_objects";
$notexml = $func($backendargs);
foreach($notexml->host as $obj) $note = strval($obj->notes);


Then while editing the same file and add the following at line 776: (next line after <div class="hostalias"><?php echo gettext("Alias:"); ?> <?php echo encode_form_val($hostalias); ?></div>)
<?php if ($note != "") { echo "<br/><div>$note</div>"; } ?>


Neat idea, I like it! :) In fact, I might do the same for my services. :)

Re: Add notes to host status page

Posted: Wed May 27, 2015 9:17 am
by tmcdonald
Thanks for the input!

I'll be closing this thread now, but feel free to open another if you need anything in the future!