[Nagios-devel] CVS nrpe_check 'result' fix

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] CVS nrpe_check 'result' fix

Post by Guest »

It was bugging me that nrpe_check.c was not picking up the
correct result code, giving me "GREEN" when load was
WARNING or CRITICAL on nrpe machines.

Debug log showed nrpe plugin was sending out a correct
result code. However running nrpe_check from the command
line to the same host and looking [echo $?] at the return
status showed that nrpe_check was not getting the correct
result.

Comparing nrpe and nrpe_check CVS sources from a day or two
ago shows that the nrpe.d does [correctly] htons to get the
int16_t packet_struct::result value.

But nrpe.c was using ntohl... oops! (at least for the
endianness on my i686 box) ... it got truncated to zero!

(The essential fix is a one-liner, so no diff just change the line)

nrpe-2.0a1/src/check_nrpe.c

/* get the return code from the remote plugin */
/* result=(int16_t)ntohl(receive_packet.result_code); orig */

result=(int16_t)ntohs(receive_packet.result_code); /*[ejk]*/

/* [ejk] should also check ..packet.packet_version
* and ..packet.packet_type for correctness/paranoia ?? */

-----------
Now check_nrpe shows yellow for WARNINGS, at least for me.
Please CC me directly if this seems acceptable as I'm not on the lists


Erik ([email protected])






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked