[FIXED] Perl script data source issue "Partial Result: U"

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

Moderators: Developers, Moderators

Post Reply
kinimod
Posts: 7
Joined: Sat Jul 11, 2015 2:26 pm

[FIXED] Perl script data source issue "Partial Result: U"

Post by kinimod »

I have two Perl scripts in the cacti/scripts/ folder:

- modem1.pl
- modem2.pl

Both are very similar and print output in a single line in key:value key:value format in a single line.

Interestingly, the modem1.pl works and populates data without any issues, but modem2.pl does not.

Code: Select all

07/11/2015 12:20:39 PM - CMDPHP: Poller[0] Host[3] DS[26] CMD: perl /Users/kinimod/cacti/scripts/modem2.pl, output: U
07/11/2015 12:20:39 PM - CMDPHP: Poller[0] Host[3] DS[26] WARNING: Result from CMD not valid.  Partial Result: U
modem1.pl scripts ends with a print statement like this:

Code: Select all

for (@keys) {
	print "$_:" . $data{$_} . " ";
}
modem2.pl script ends with a print statement like this:

Code: Select all

for (@DownSnR, @DownPWR, @UpPWR) {
	print "$_" . " ";
}
When scripts are run in terminal, they output exactly the same line:

Code: Select all

DownSnR1:36 DownSnR2:35 DownSnR3:35 DownSnR4:35 DownSnR5:34 DownSnR6:34 DownSnR7:35 DownSnR8:34 DownPWR1:7 DownPWR2:5 DownPWR3:6 DownPWR4:5 DownPWR5:4 DownPWR6:4 DownPWR7:5 DownPWR8:4 UpPWR1:45 UpPWR2:45 UpPWR3:46 UpPWR4:49
Whenever I go into Cacti's "Data Input Methods" view and change the path to the script from modem1.pl to modem2.pl, I start to see the "Partial Result: U" error in the log and data stops populating.

I want to use my modem2.pl script because it's more efficient and future-proof.

Any ideas? Both modem1.pl and modem2.pl have exactly the same read/write/execute attributes and same owner:group. I searched the forums for this issue without finding a working solution.
Last edited by kinimod on Sat Jul 11, 2015 6:21 pm, edited 1 time in total.
kinimod
Posts: 7
Joined: Sat Jul 11, 2015 2:26 pm

Re: Perl script data source issue "Partial Result: U"

Post by kinimod »

Just to clarify, it must be something wrong with the script (cacti being sensitive to the actual script content), because if I use the modem2.pl file content in the modem1.pl file and save it, I get the same "Partial Result: U".

But why? The updated script prints exactly the same key:value line.
kinimod
Posts: 7
Joined: Sat Jul 11, 2015 2:26 pm

Re: Perl script data source issue "Partial Result: U"

Post by kinimod »

Fixed!

My modem2.pl script was using an extra module that perl couldn't find in the @INC path variable.

For other readers:

If you get this error, the causes might be the following:
- poller.php initiates a different perl than you think, you might have multiple perl binaries in your system
- poller.php executes the perl script in a different shell than you think, and that shell does not have @INC variables set, resulting in the perl script failing because it can not find the proper modules

I fixed the issue by configuring my Cacti's "Input string" in "Data Input Methods" view like this:

Code: Select all

/usr/bin/perl -I /Users/kinimod/perl5/lib/perl5 /Users/kinimod/cacti/scripts/modem2.pl
Description:

1) provide full path to the perl binary you desire
2) add:

Code: Select all

-I
and then

Code: Select all

/Your/Path/To/PerlModules
This will force-prepend the @INC variable regardless of the shell environment variables or other factors
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest