Stop Nagios from inserting things into Services Page..?
Posted: Thu Jan 17, 2013 11:18 am
Hello All,
Nagios Core 3.2.3
I have NSCA running on another server. From that NSCA server I send Nagios the proper "send_nsca" message, but in the
last portion of the Message string (which is the 'status message' of the service) I send Nagios a list of files to display
using some <ul> and <li> tags. Which is pretty cool because I didn't think about that before, where you could BOLD something
using the <b> tags and stuff like that.
So I decided I would send it a File list from NSCA.
Here is the NSCA message being sent to nagios:
# Here is the Status 'MESSAGE' portion of the string above, so it's a little more readable...
That echo command above gets piped to the send_nsca command. Which sends the last portion (*i.e. after the last comma,
which is the delimiter) to Nagios as is, as its 'Status Information'. Then it displays the list in the cell as so...
The problem I'm having is that after I send the string, then look at it in the web page I notice there is alot of extra space after the list
in the cell. So I used the Firefox Web Developer Tool and viewed the Frame's source code of that "Service Status" page (*i.e. the
page that displays ALL Services' Statuses) and I could see that which ever CGI script, (*I assume it's a CGI Script that does it?), it
inserts a at the end of the message before the closing </TD> tag which closes that Table's Cell. The cells I'm talking
about are in the Column for "Status Information".
# Here is the line from the Services Web Page that displays my 'Message' I send it...
***As you can see there is now a " " after MY closing </ul> tag, but before their closing </TD> tag...
Anyway, the " " that gets appended really adds alot of extra space after the list (*i.e. after MY closing </ul> tag.) and
if I remove the " " it removes this space and displays perfectly. I also tried removing the " " from a cell
in the table that was PLAIN TEXT ONLY and then refreshed the page and it did nothing to change the way it was displayed...
So I thought maybe, since Nagios Core is Open-Source, I could get into the script that builds those html pages and stop it from appending
the " " to the end of your "Status Message"...
Anyone know which script does this?
Or any other thoughts would be much appreciated as well...!
Thanks in Advance,
Matt
Nagios Core 3.2.3
I have NSCA running on another server. From that NSCA server I send Nagios the proper "send_nsca" message, but in the
last portion of the Message string (which is the 'status message' of the service) I send Nagios a list of files to display
using some <ul> and <li> tags. Which is pretty cool because I didn't think about that before, where you could BOLD something
using the <b> tags and stuff like that.
So I decided I would send it a File list from NSCA.
Here is the NSCA message being sent to nagios:
Code: Select all
echo "Host_Name1,Service Description String,2,<b>CRITICAL: <i>There are File(s) >= 1.5 GB:</i></b><ul type='' style='display: inherit;'><li>Test_File_1 (1.81 GB)</li><li>Test_File_2 (1.51 GB)</li></ul>"
Code: Select all
<b>CRITICAL: <i>There are File(s) >= 1.5 GB:</i></b>
<ul type='' style='display: inherit;'>
<li>Test_File_1 (1.81 GB)</li>
<li>Test_File_2 (1.51 GB)</li>
</ul>
which is the delimiter) to Nagios as is, as its 'Status Information'. Then it displays the list in the cell as so...
The problem I'm having is that after I send the string, then look at it in the web page I notice there is alot of extra space after the list
in the cell. So I used the Firefox Web Developer Tool and viewed the Frame's source code of that "Service Status" page (*i.e. the
page that displays ALL Services' Statuses) and I could see that which ever CGI script, (*I assume it's a CGI Script that does it?), it
inserts a at the end of the message before the closing </TD> tag which closes that Table's Cell. The cells I'm talking
about are in the Column for "Status Information".
# Here is the line from the Services Web Page that displays my 'Message' I send it...
Code: Select all
<TD CLASS='statusBGCRITICAL' valign='center'><b>CRITICAL: <i>There are File(s) >= 1.5 GB:</i></b><ul type='' style='display: inherit; page-break-after:avoid;'><li>STAT.YR4YR5.JWP - (1.65 GB)</li><li>SERIESTABLE.JWP - (1.54 GB)</li><li>PROD.POINTER - (2.01 GB)</li><li>ORDER.HISTORY.LINE - (1.51 GB)</li></ul> </TD>
Anyway, the " " that gets appended really adds alot of extra space after the list (*i.e. after MY closing </ul> tag.) and
if I remove the " " it removes this space and displays perfectly. I also tried removing the " " from a cell
in the table that was PLAIN TEXT ONLY and then refreshed the page and it did nothing to change the way it was displayed...
So I thought maybe, since Nagios Core is Open-Source, I could get into the script that builds those html pages and stop it from appending
the " " to the end of your "Status Message"...
Anyone know which script does this?
Or any other thoughts would be much appreciated as well...!
Thanks in Advance,
Matt