WARNING: Result from CMD not valid

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
credulous1
Posts: 3
Joined: Fri Aug 15, 2008 10:08 pm

WARNING: Result from CMD not valid

Post by credulous1 »

I am having problems with a script to allow graphing of Linux sensor information on 2 servers I have. The wierd thing is that if I run poller from command line it works, but if I run it from crontab it fails with :-

08/16/2008 04:15:02 AM - CMDPHP: Poller[0] Host[1] DS[62] WARNING: Result from CMD not valid. Partial Result: Core0: Core1
08/16/2008 04:15:02 AM - CMDPHP: Poller[0] Host[1] DS[62] CMD: perl /usr/share/cacti/scripts/sens_test.pl, output: U

I have checked my script for the usual problems environment problems with crontab and all seems OK, below is output if I run poller from commandline as cacti

08/16/2008 04:20:08 AM - CMDPHP: Poller[0] Host[1] DS[62] CMD: perl /usr/share/cacti/scripts/sens_test.pl, output: Core0:67 Core1:66


Script below :-

#!/usr/bin/perl
$type='Core';
$sensprog='/usr/bin/sensors';
open(SENSOR, "$sensprog |");
$count=0;
foreach (<SENSOR>) {
chomp; # no newlines
s/\t/ /g; # change tabs to whitespace
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
s/\s\s*/ /g; # remove duplicate spaces
s/\r//; # kill DOS cr
if ( $_ =~ /^$type/ ) {
@line=split / /;
$core[$count]=substr($line[2],1,-3);
$count++;
}
}
close(SENSOR);
#print "Core0:66 Core1:63";
print "Core0:$core[0] Core1:$core[1]";


I have a couple of questions :-
1) Is there anyway I can see debug output from my script (if I put some in !!), or can I see what output actually comes from the script rather that just 'U'?
2) does anyone have any ideas why my script works from commandline, and also is poller runs from command line, but not when run from crontab?

Thanks

Steve
dus001
Posts: 42
Joined: Sun Aug 07, 2005 6:07 am

Post by dus001 »

08/16/2008 04:15:02 AM - CMDPHP: Poller[0] Host[1] DS[62] CMD: perl /usr/share/cacti/scripts/sens_test.pl, output: U
in you data input method, try to prefix perl command with complete path ('/usr/bin' probably).

1) Is there anyway I can see debug output from my script (if I put some in !!), or can I see what output actually comes from the script rather that just 'U'?
Creating a log file and writing debug data into it should work.
credulous1
Posts: 3
Joined: Fri Aug 15, 2008 10:08 pm

Post by credulous1 »

I have just tried that, but still the same, I do have other perl scripts that work fine, however this is my first that produces more that one field:value combination.

Good idea about debugging output to a file .. I will try that.

Any other ideas?

Thanks for your help

Steve
credulous1
Posts: 3
Joined: Fri Aug 15, 2008 10:08 pm

Post by credulous1 »

Wierdly with debugging output to a file, I see nothing in debug file when run from cron .. not a sausage.

Also I checked poller_item table and the change to date input method (/usr/bin/perl) had not taken effect, so I manually updated arg1 column. Is there a way to do this via web portal? BTW changing this had no effect, I still see nothing in debug file and output: U in cacti logs.

Thanks

Steve
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

credulous1 wrote:Wierdly with debugging output to a file, I see nothing in debug file when run from cron .. not a sausage.

Also I checked poller_item table and the change to date input method (/usr/bin/perl) had not taken effect, so I manually updated arg1 column. Is there a way to do this via web portal? BTW changing this had no effect, I still see nothing in debug file and output: U in cacti logs.

Thanks

Steve
Please use the "rebuild_poller_cache.php" after changing a data_input_method
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest