Add notes to host status page

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
phobbs
Posts: 7
Joined: Tue Oct 29, 2013 12:19 pm

Add notes to host status page

Post 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
---
> ?>
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Add notes to host status page

Post 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
phobbs
Posts: 7
Joined: Tue Oct 29, 2013 12:19 pm

Re: Add notes to host status page

Post 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.
yabonio
Posts: 1
Joined: Thu Sep 05, 2013 7:59 am

Re: Add notes to host status page

Post by yabonio »

PHOBBS: Can i ask you where to put your patch?

i'm really interested on it.

Thank you.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add notes to host status page

Post 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.
Former Nagios employee
krutaw
Posts: 60
Joined: Wed Jul 31, 2013 6:30 pm

Re: Add notes to host status page

Post 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. :)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add notes to host status page

Post 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!
Former Nagios employee
Locked