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
WARNING: Result from CMD not valid
Moderators: Developers, Moderators
in you data input method, try to prefix perl command with complete path ('/usr/bin' probably).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
Creating a log file and writing debug data into it should work.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'?
-
- Posts: 3
- Joined: Fri Aug 15, 2008 10:08 pm
-
- Posts: 3
- Joined: Fri Aug 15, 2008 10:08 pm
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
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
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please use the "rebuild_poller_cache.php" after changing a data_input_methodcredulous1 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
Reinhard
Who is online
Users browsing this forum: No registered users and 0 guests