Page 1 of 1

Strange Symbols with NRPE Command Execution

Posted: Thu May 10, 2012 3:14 pm
by mmartin
Hello All,

I have a pretty simple script that basically reports to Nagios the stats of a particular process. Reporting back with CPU%, MEM%, CPU-TIME, etc...

Now when I execute the script from Nagios using check_nrpe I get an extra line in the output that contains strange symbols.
But when I execute the script from the server that has NRPE running on it, i.e. executing it directly without using NRPE, it works just fine.

Executing through NRPE:

Code: Select all

./check_nrpe -H 192.168.4.115 -t 10 -c check_javaProcess -n
OK: The CPU-Usage(%) is below ALL Warning Levels. CPU: 0.0%, RAM: 0.0%, CPU-TIME: 113 Min | CPU=0.0; Memory=0.0; PID=450688; CPU-Time=113; Virtual-Mem=18496; Physical-Mem=18548
	¼h/ñî°

./check_nrpe -H 192.168.4.115 -t 10 -c check_connectionMonitor -n
CRITICAL: Process is not running!
ÿÿ 7ûð&0 7X/ñëð'¤ÌÐz‡P

./check_nrpe -H 192.168.4.115 -t 10 -c check_WebSrv -n
WARNING: The CPU-Usage(%) is higher than the WARNING Level. CPU: 19.5%, RAM: 9.0%, CPU-TIME: 239608 Min | CPU=19.5; Memory=9.0; PID=381174; CPU-Time=239608; Virtual-Mem=481584; Physical-Mem=481636
ÿÿÿð'¤Ìð&0ð&0Hÿÿÿÿ 7èð&0 7X/ñëÀð'¤ÌÐz‡P
As you can see in the examples above, the 2nd line for each of those commands prints some strange symbols.
But like I mentioned above it doesn't print these symbols when executing locally.... I'm Stumped!!!!

Anyone have any idea what would cause NRPE to print these weird symbols..?
Any thoughts at all would be GREATLY appreciated...

EDIT:
Forgot to mention the host OS is AIX. And also this is happening for any script. I tried a couple of basic check commands, i.e. check_users, and the result is the same.

Thanks in Advance,
Matt

Re: Strange Symbols with NRPE Command Execution

Posted: Fri May 11, 2012 3:19 pm
by mmartin
In case anyone has this same issue I will leave this post up. I was able to get rid of the issue by updating NRPE to a new version.
The version that was giving trouble was "v2.10" and I switched out the ".../nagios/bin/nrpe" with the version "v2.12" and that seemed to fix the issue.

I also found this post on another forum, it may help anyone that cannot possibly change the version, etc...:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498749

Here is the part with the answer:

Code: Select all

This seems to me caused by the fact, that the buffer allocated
in nrpe.c is never nulled bevore used, using a memset to 0 fixes
the problem

--- src/nrpe.c.orig     2008-09-13 01:44:54.000000000 +0200
+++ src/nrpe.c  2008-09-13 01:44:09.000000000 +0200
@@ -1088,6 +1088,9 @@

        /* disable connection alarm - a new alarm will be setup during
my_system */
        alarm(0);
+
+        // null buffer befor using it!
+       memset(buffer,0,sizeof(buffer));

        /* if this is the version check command, just spew it out */
        if(!strcmp(command_name,NRPE_HELLO_COMMAND)){

Hope that helps...

-Matt

Re: Strange Symbols with NRPE Command Execution

Posted: Fri May 11, 2012 5:06 pm
by jsmurphy
Thanks for sharing the solution!

Re: Strange Symbols with NRPE Command Execution

Posted: Wed May 16, 2012 9:46 am
by mmartin
No Problem... My Pleasure!

Thanks,
Matt