Bugfix: Parsing of Long Plugin Output for Async Host Checks

Ton Voon tonvoon at gmail.com
Thu Jan 20 00:39:24 CET 2011


Jochen,

Thanks for the patch. I've applied to CVS HEAD now.

Ton

On 3 Dec 2010, at 19:56, Jochen Bern wrote:

> Async host check results get parsed differently from sync host and
> service check results:
>
> # grep -n parse_check_output nagios-3.2.3/*/*.c
> nagios-3.2.3/base/checks.c:1024: parse_check_output(...,TRUE,TRUE);
> nagios-3.2.3/base/checks.c:2730: parse_check_output(...,TRUE,TRUE);
> nagios-3.2.3/base/checks.c:3313: parse_check_output(...,FALSE,TRUE);
> nagios-3.2.3/base/utils.c:2685:int parse_check_output(..., int
> escape_newlines_please, int newlines_are_escaped){
>
> In 3.2.3, this causes the long output to be stored in the status.dat
> with *actual* line breaks, while the same plugin output fed into a
> service check has its line breaks changed to "\n":
>
> # ../libexec/check_icmp_plus -H 127.0.0.1
> OK - 127.0.0.1: rta 0,039ms, lost 0%|rta=0,039ms;200,000;500,000;0;
> pl=0%;40;80;; rtmax=0,078ms;;;; rtmin=0,028ms;;;;
> Long Output Zeile 1
> Long Output Zeile 2
>
> # grep 'Long Output' ../var/spool/status.dat
>        long_plugin_output=Long Output Zeile 1
> Long Output Zeile 2
>        long_plugin_output=Long Output Zeile 1\nLong Output Zeile 2\n
>
> extinfo.cgi, in turn, would read long_plugin_output= only up to the
> first line break, thus missing the subsequent lines of the long output
> entirely. (I'm also under the impression that restarting Nagios caused
> the orphaned second line to simply *vanish* from status.dat until the
> next check, but I didn't doublecheck.)
>
> Note that in 3.2.2 and earlier, an independent bug in utils.c::2833
>> http://nagios.cvs.sourceforge.net/viewvc/nagios/nagios/base/utils.c?r1=1.249&r2=1.250
> prevented the parameter value from actually taking effect.
>
> Simply changing the parameters to (...,TRUE,TRUE) fixes this.
>
> Kind regards,
> 								J. Bern


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl




More information about the Developers mailing list