Multiple lines of data in Status field?
Gerald Wichmann
gwichman at zantaz.com
Wed Feb 5 19:40:09 CET 2003
I *definetly* saw multiple lines. I.e. not just wrapped-around. Somehow it
imbedded a newline AND nagios displayed it on the other end in the status
field. I'm trying to reproduce it again but so far haven't had any luck.
Gerald Wichmann
Senior Systems Development Engineer
Zantaz, Inc.
925.598.3099 (w)
-----Original Message-----
From: Stanley Hopcroft [mailto:Stanley.Hopcroft at IPAustralia.Gov.AU]
Sent: Tuesday, February 04, 2003 7:14 PM
To: Subhendu Ghosh
Cc: Gerald Wichmann; Nagios (E-mail)
Subject: Re: [Nagios-users] Multiple lines of data in Status field?
Dear Gentlemen,
I think there are a number of factors,
1 The maximum buffer space Nag allocates to store the output of a plugin
2 How much of the plugin output it captures (to save in the buffer),
obviously <= 1
The value for 1 is given by
#define MAX_PLUGINOUTPUT_LENGTH 352
in common/objects.h
The value for 2 is found in base/checks.c
/* grab the plugin output and clean it */
fgets(plugin_output,sizeof(plugin_output)-1,fp);
strip(plugin_output);
ie Nag uses fgets to get the smaller of one 'line' of output and the
MAX_PLUGINOUTPUT_LENGTH number of characters.
Further input and output in the IPC mechanism (is it named pipe ?) may
further reduce the number of characters handed to the CGIs or the
notifcation/logging processes and these in turn may have their own
limits.
However, since it seems to me that Nag uses exclusively the safe forms
of buffer and string copying (strncpy etc), you could
. Have your plugin substitute all new line characters in its output for
spaces or '.' (leaving only a traling \n) and
. hand that to Nag for processing (by returning it as the output).
This works quite Ok for me.
Here's an example :-
To sum up, you can't get multi-line, but you can get quite a lot more
than one line of 80 chars.
Ok. 7 DCs responded [IPOZ IPA04 CBR1 IPABETA IPA02 IPA03 IPA01] to
\MAILSLOT\NET\NETLOGON. "CBR1" validated "stan2". Lanman logon script
"\kixtart\kickstart.bat". Connected to "\\IPA02\PD_NEW_DATA
\\IPA02\Apps32 \\IPA04\SMALLSYSTEM \\IPA04\Apps16 \\IPA04\ITSBUILTAPPS
".
tsitc> cat | wc -c
Ok. 7 DCs responded [IPOZ IPA04 CBR1 IPABETA IPA02 IPA03 IPA01] to
\MAILSLOT\NET\NETLOGON. "CBR1" validated "stan2". Lanman logon script
"\kixtart\kickstart.bat". Connected to "\\IPA02\PD_NEW_DATA
\\IPA02\Apps32 \\IPA04\SMALLSYSTEM \\IPA04\Apps16 \\IPA04\ITSBUILTAPPS
".
272
tsitc>
On Tue, Feb 04, 2003 at 09:18:47PM -0500, Subhendu Ghosh wrote:
> The output of a plugin is usually limited to 512 bytes and can be separate
> into 2 parts - line 1 is the OUTPUT that goes into the log
> everything from line2 (specially after the | ) goes into PERFDATA.
>
> -sg
>
> On Tue, 4 Feb 2003, Gerald Wichmann wrote:
>
> > I once got nagios to show multiple lines in the status field. Not sure
how
> > that happened though..somehow I was assigning the output of a command
like
> > "wc -l *.log" to a variable like OUTPUT, then echo'ing that output as
the
> > status for my little check script. In Nagios it showed up in the status
> > field as each file having it's own line.. I was surprised to see it but
now
> > I can't recall how I got it to do that. Is there a trick to formatting
the
> > output of a check script to show several lines?
> >
> > Gerald Wichmann
> > Senior Systems Development Engineer
> > Zantaz, Inc.
> > 925.598.3099 (w)
> >
> >
>
Yours sincerely.
--
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------
'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'
from Meditation 17, J Donne.
This e-mail has been captured and archived by the ZANTAZ Digital Safe(tm)
service. For more information, visit us at www.zantaz.com.
IMPORTANT: This electronic mail message is intended only for the use of the
individual or entity to which it is addressed and may contain information
that is privileged, confidential or exempt from disclosure under applicable
law. If the reader of this message is not the intended recipient, or the
employee or agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received
this communication in error, please notify the sender immediately by
telephone or directly reply to the original message(s) sent. Thank you.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
More information about the Users
mailing list