Open file output with more then one line.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nms
Posts: 222
Joined: Wed Sep 28, 2016 9:35 am

Open file output with more then one line.

Post by nms »

Hi,

i have a file which contains more then one line entry. A Sample below:
cat sample.txt
Alarm Id : alarm85
Severity : Critical
Type : 6180.ProblemEvent
Topic : Tray.00.Drive.12
Event Code : 90.66.1025
Date : 2018-03-17 01:54:54
Device : am1da01[SUN.540654504.1137EH0009]
Description : Impending drive failure in Virtual Disk sms-edr-vd (Medium
Data Availability Risk), affected drive(s): Tray.00.Drive.12
State : Open
Acknowledged By : -
Auto Clear : Y
Aggregated Count : 0

Alarm Id : alarm89
Severity : Critical
Type : 6180.ProblemEvent
Topic : Tray.85.Drive.03
Event Code : 90.66.1025
Date : 2018-04-15 05:02:19
Device : am1da01[SUN.540654504.1137EH0009]
Description : Impending drive failure in Virtual Disk sms-vd (Medium Data
Availability Risk), affected drive(s): Tray.85.Drive.03
Tray.85.Drive.05 Tray.85.Drive.12
State : Open
Acknowledged By : -
Auto Clear : Y
Aggregated Count : 0
is this possible to make it all visible in the Nagios Status Information?

As per attached is seems it's limited . Is there a way to change the amount of length for output?

The aim is to have a simple script which counts the number of critical alarms. if for example the count is greater then 0 then i'll display this file in the status information.

Rgds,

Matthew
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Open file output with more then one line.

Post by rkennedy »

The data in your screenshot, appears to be the same text quoted - Nagios XI looks to be displaying the multi-lines properly, as it should.

Could you please clarify what you're looking for?
Former Nagios Employee
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Open file output with more then one line.

Post by mcapra »

I also do not see a difference in the two provided outputs.

That aside, this KB article has steps to prevent your status information from being cut-off after 256 characters if you are encountering that particular problem:
https://support.nagios.com/kb/article.php?id=478
Former Nagios employee
https://www.mcapra.com/
nms
Posts: 222
Joined: Wed Sep 28, 2016 9:35 am

Re: Open file output with more then one line.

Post by nms »

Hi,

Sorry maybe i wasn't clear enough. if you click on the overview then that's fine as it shows the multiple output.
What i mean is if all those lines can be displayed in the Status Information, being a non one liner output.
As you can see in the attached it just stops after certain Kb of data. I think there's a limitation for that somehow.

@mcapra, i already have the limitation set from being cut-off, so i guess there's an extra limitation somewhere for plugin output? or maybe the output should be represented in an other way?

Rgds,

Matthew
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Open file output with more then one line.

Post by mcapra »

In this case, there's 2 different macros Nagios Core uses to capture status output: $SERVICEOUTPUT$ and $LONGSERVICEOUTPUT$. There are also corresponding macros for host outputs. More info here:
https://assets.nagios.com/downloads/nag ... olist.html

I think the status overview is hard-wired to use $SERVICEOUTPUT$, which will only ever capture the first line of a status output. You'd have to make fundamental changes to the status overview pages to get what you're looking for. Perhaps a tech can confirm this?
Former Nagios employee
https://www.mcapra.com/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Open file output with more then one line.

Post by npolovenko »

@nms, With what @mcapra said about using the correct macros, I think it's still not possible to display multiline output in the status overview. That is how the homepage component was built->it will only show the first line. I tried to achieve something similar not so long ago. With some tweaking, you could extend the status information to display all lines of output as a very long single line output.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked