[Nagiosplug-help] Nonprintable characters in check_tcp

Darren Gamble Darren.Gamble at sjrb.ca
Thu Apr 24 08:46:12 CEST 2003


Good day,

> I just tried:
> 
> perl -e 'print chr(255)'
> 
> ... and that put something on my screen. Can't say for sure 
> that it was a null 
> character, but it may have been.

chr(0) would be a null. =)

> Anyhow, on a Linux/UNIX system if you pass the above line to 
> your plugin 
> enclosed in back-ticks Linux will shell out, run Perl, Perl 
> will run 'print 
> chr(255)', and the output will end up in your command line 
> being passed to 
> the plugin.
> 
> See if that works.

I'd have to look at the code for sure, but I'm guessing that the plugin uses
a regular char array to store the data.  The null character denotes the end
of a C string, so the plugin probably misinterprets it as the end of the
string.  At any rate, the server doesn't get the null character.
 
> Alternately you could just use Perl to write a custom plugin 
> that attaches to 
> your IP:port and sends whatever characters you want, then 
> returns "OK" or 
> "CRITICAL".

I have been trying to avoid that, but yes, I think I'll just have to write a
better "check_tcp" in Perl or C or something that can handle this. =/
 
At any rate, your reply was appreciated- thanks!

============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948




More information about the Help mailing list