CACTID: Poller[0] Host[1] ERROR: Empty result

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

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

Post by gandalf »

Are you using any OS commands in your script? May you please post the code?
Reinhard
deu439356
Cacti User
Posts: 73
Joined: Wed Aug 13, 2008 8:08 am

Post by deu439356 »

I am not using any OS commands.

values.txt File contains:
20
5
25


My Script (I am just printing out the first number from the file):

Code: Select all

#!/usr/bin/perl

$stats = "./values.txt";

my $counter = 0;
my $result = "";
   @var = ();
open(STATFILE,"< $stats") or die "Can't open $stats for read:$!\n";

while ($line = <STATFILE>) {
   chop $line;
#   print "$line\n";
   $var[$counter] = $line;
   $counter++;
}

close(STATFILE);

print $var[0];
Attachments
dataTemp.JPG
dataTemp.JPG (184.47 KiB) Viewed 2955 times
dataInput.JPG
dataInput.JPG (132.28 KiB) Viewed 2956 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please provide the full path the the data file and retry
Reinhard
deu439356
Cacti User
Posts: 73
Joined: Wed Aug 13, 2008 8:08 am

Post by deu439356 »

My apologies. I do have the full path in there. I had removed it for troubleshooting different possibilities. Currently the full path is present.
deu439356
Cacti User
Posts: 73
Joined: Wed Aug 13, 2008 8:08 am

Post by deu439356 »

I tried putting my script in the unix_users.pl script (since I am graphing that one), but I still get the errors. What is different between my output and the output from the unix_users script? They both return numbers... Here is the unix_users.pl script (this works, mine above doesn't).

Code: Select all

#!/usr/bin/perl

my $grep_string = $ARGV[0];

chomp $grep_string;

if ($grep_string eq '') {
        open(PROCESS, "who | grep -c : |");
}else{
        open(PROCESS, "who | grep : | grep -c $grep_string |");
}
$output = <PROCESS>;
close(PROCESS);
chomp($output);
print $output;
deu439356
Cacti User
Posts: 73
Joined: Wed Aug 13, 2008 8:08 am

Post by deu439356 »

Gandalf,

I miss read your post. I thought you were talking about the path in the Data Input screen to the script. I put the full path in the script that points to my data file and that resolved my issue. Thank you for your time and helping me resolve this!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Ahh, I'm glad. I just tried all stuff and it worked for me.
CU
Reinhard
duanew
Posts: 16
Joined: Tue Apr 03, 2007 12:04 am
Location: Brisbane, Australia

Re: CACTID: Poller[0] Host[1] ERROR: Empty result

Post by duanew »

I had the same problem. I have this problem with CRON jobs as well when I schedule perl scripts.

In our company we are only allowed full access to /apps/local so Perl modules must be installed under /apps/local/perl so I need to run the profile so set environment variables before the script is invoked.

Instead of "/usr/bin/perl /apps/local/cacti/scripts/scriptx.pl" I need to use:

". ~/.profile;/usr/bin/perl /apps/local/cacti/scripts/scriptx.pl"

One of the commands in profile sets the perl library path:

export PERL5LIB=/apps/local/perl/lib/perl5/site_perl/5.8.8:/apps/local/perl/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi

So my scripts fail when I forget to add that line in the Cacti command.

So it is not only rights that stops a perl script from running.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests