On 05/11/2012 09:34 PM, Jochen Bern wrote:
> Everyone,
> I played with the "-c" and "-s" Parameters of a 3.2.3's nagiostats toda=
y
> and noticed the odd behavior shown below. I didn't look at the source
> yet, much less write a patch, but I thought you might want to check on
> 3.3.x and 3.4.x beforehand (and maybe extend t/705nagiostats.t a bit).
To answer my own (implied) question:
base/nagiostats.c uses a different subroutine, read_nagiostats_file(),
to read and parse a status file named by the -s option; when parsing
nagios.cfg (default or -c option) and grabbing the value of the
status_file directive there, read_status_file() is used instead.
As far as I can tell, read_status_file() matches the current status.dat
syntax, while read_nagiostats_file() expects a format that plain isn't
to be found anywhere else anymore. For example, it's the only place in
the code where I can find the string "nagios_version", which it parses fo=
r.
The figure nagiostats outputs for NUMSVCOK (the one I focused on in my
last post - *not* the only one resulting in wrong numbers) is actually
*counted* in status.dat by read_status_file(), while
read_nagiostats_file() expects it to be *stated* as "services_ok" in the
file read; again, this seems to be the only place in the code where
"services_ok" appears *as a string* (rather than a variable of the same
name).
Any chance that the -s option might be reappropriated to read the
current status.dat files via read_status_file(), rather than a format
lost in the sands of time ... ?
Kind regards,
J. Bern
--=20
Jochen Bern, Systemingenieur --- LINworks GmbH
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP =3D D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C2=
7
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Gesch=E4ftsf=FChrer Metin Dogan, Oliver Mic=
hel
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: Jochen.Bern@LINworks.de