Problem returning data from Perl Check script
Posted: Sat Nov 01, 2014 11:00 pm
Greetings,
I'm having trouble displaying data in Nagios Core 3.5.1 that should be returned from a Perl "Check" script.
The script is a modified version of this script: http://exchange.nagios.org/directory/Pl ... mp/details
Instead of communicating with the USB port from within the script, I'm calling a shell script that executes a C program that returns a temperature.
The Request process looks something like this:
Nagios (localhost.cfg) --> check_tempr.pl --> grabtemp.sh --> pcsensor (executable)
When I run grabtemp.sh from the commandline, I get the expected result (a temperature in the form 23.33).
When I run the check_tempr.pl script from the commandline I also get the expected data.
When I look at the data in Nagios, I get formatted data returned from the check_tempr.pl script without the actual numeric temperature data.
From check_tempr.pl, I'm calling the shell script using the back quote method, which I understand to be correct. Am I missing something about calling a shell script if my intent is to pass data up yet another level to Nagios?
Here is how I'm calling the shell script from the Perl script:
$tempRead = `/usr/local/nagtemp/grabtemp.sh`;
Any ideas? What other information can I provide?
Thanks very much,
John
I'm having trouble displaying data in Nagios Core 3.5.1 that should be returned from a Perl "Check" script.
The script is a modified version of this script: http://exchange.nagios.org/directory/Pl ... mp/details
Instead of communicating with the USB port from within the script, I'm calling a shell script that executes a C program that returns a temperature.
The Request process looks something like this:
Nagios (localhost.cfg) --> check_tempr.pl --> grabtemp.sh --> pcsensor (executable)
When I run grabtemp.sh from the commandline, I get the expected result (a temperature in the form 23.33).
When I run the check_tempr.pl script from the commandline I also get the expected data.
When I look at the data in Nagios, I get formatted data returned from the check_tempr.pl script without the actual numeric temperature data.
From check_tempr.pl, I'm calling the shell script using the back quote method, which I understand to be correct. Am I missing something about calling a shell script if my intent is to pass data up yet another level to Nagios?
Here is how I'm calling the shell script from the Perl script:
$tempRead = `/usr/local/nagtemp/grabtemp.sh`;
Any ideas? What other information can I provide?
Thanks very much,
John