Bugfix: Parsing of Long Plugin Output for Async Host Checks
Jochen Bern
Jochen.Bern at LINworks.de
Fri Dec 3 20:56:12 CET 2010
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
--
Jochen Bern, Systemingenieur --- LINworks GmbH <http://www.LINworks.de/>
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nagios-3.2.3-HostCheckParseFix-patch.txt
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20101203/319cd5c8/attachment.txt>
-------------- next part --------------
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list