check_mrtg and check_mrtgtraf appear to return incorrectly


#1

I have Nagios 3.0.3, now with plugins v1.4.13 running on CentOS inside Microsoft Virtual Server.

check_mrtg returns “unknown” if the status is ok.
In the code, the status is initialised to unknown and is only changed if a warning or critical state is detected.

check_mrtgtraf does not accept the -v arg, however the definition in the nagios commands.cfg requires you to enter it.
(try running from command line, ignoring what the help text says because that is also incorrect, to see this in action)

check_mrtgtraf returns “warning” if the status is ok. I didn’t trawl through the code but judging from the help text, both plugins are based on the same base and appear to contain similar logic.

My aim in posting this is to get hold of someone who can …
…/ write c fluently (I can just about ‘read’ it, but that’s all)
…/ comply with Nagios standardisation
…/ verify if I’m crazy (possible) or correct
…/ fix and post corrected plugins if required.

  • I can post many lines of ‘evidence’ however I’m loathe to start a thread with too much information.
  • I have selected “notify me when a reply is posted”.
  • I have been pointed at the official mailing list, and joined it, however all emails sent to this return with “unable to relay”, is possible they don’t like gmail?, I do.

#2

Due to lack of response, I wrote my own “check_mrtglog”. I doubt the code is all that elegant and things like longopts got ignored but it does what check_mrtg seems to be supposed to do. It just does it correctly. I will clean it up a bit and test it with various inputs.

A real programmer would be able to clean up some redundant code where char arrays declared as *name are incompatible with strcmp and had to be have name-fix[x] duplicates created. I’m not sure if it’s important but gcc on CentOS5.2 thinks nearly all the original code is not ansi-c and this is apparently a bad thing (it certainly caused me grief trying to compile bits of it and finding missing libraries and uncompilable code.)

ANYONE who can do it properly, please have a look at the code for check_mrtg and check_mrtgtraf. A note here if you fix them would be appreciated.