Result from SCRIPT not valid. Partial Result

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

Moderators: Developers, Moderators

Post Reply
yardus9
Cacti User
Posts: 77
Joined: Tue Jan 27, 2004 5:32 pm

Result from SCRIPT not valid. Partial Result

Post by yardus9 »

Greetings,
I am having problem graphing data from a perl script, it seems to be returning with the dreaded "U". Here is what I am seeing in my DEBUG log for this host:

12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] PING: Result TCP: Host is Alive
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] Host has no information for recache.
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] DEBUG: The POPEN returned the following File Descriptor 13
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] ERROR: Empty result [rpc1-a2]: 'perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a2'
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] DS[11358] WARNING: Result from SCRIPT not valid. Partial Result: ...
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] DS[11358] SCRIPT: perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a2, output: U
12/17/2007 05:55:09 PM - SPINE: Poller[0] Host[595] DEBUG: The POPEN returned the following File Descriptor 9
12/17/2007 05:55:13 PM - SPINE: Poller[0] Host[595] DS[11359] SCRIPT: perl /web/cacti-0.8.7/scripts/ping.pl 10.XXX.XXX.XXX, output: 1.09
12/17/2007 05:55:13 PM - SPINE: Poller[0] Host[595] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function

I run the script as the cacti user, and i get the following output:
[cacti~]$ perl /web/cacti/scripts/rpcdata.pl rpc1-a2
32.0 12.6

I tried changing the output to this:
[cacti~]$ perl /web/cacti/scripts/rpcdata.pl rpc1-a2
33.0
12.5

I get the same error. Any ideas? I searched around the forum, could not find anything that seemed the same.
Thanks in advance.

CENTOS 4.5
cacti 0.8.7
spine 0.8.7.a
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Neither of those syntaxes is correct. It must be a name value pair, single space and delimited with a colon.

variableA:valueA variableB:valueB

You must output all at once as well, no partial output.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
yardus9
Cacti User
Posts: 77
Joined: Tue Jan 27, 2004 5:32 pm

Post by yardus9 »

Ok, thanks for the response. I have changed my script output to the following:

[cacti@nms2 ~]$ perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1
amps:14.1 temp:35.5[cacti@nms2 ~]$

do I want to return a new line? I tried this as well:
[cacti@nms2 ~]$ perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1
amps:13.7 temp:35.5
[cacti@nms2 ~]$


Is my problem strictly with the script output, or could it be related to how my Data Templates are set up?
I notice in my Data Input Method, a Field Order for the Output Fields, they are both set to "0(Not In Use)". Do these need to be changed to accept the output, if so, I cannot find an option to configure them.


The script is connecting to a PDU and pulling out the values for amps and temp.


Here is an export of my Data Template:


<cacti>
<hash_01001417b334f3f16bc1d5d9d174d090b11ac5>
<name>RPC-Data Template</name>
<ds>
<t_name></t_name>
<name>rpcdata</name>
<data_source_path><path_rra>/temp_6878.rrd</data_source_path>
<data_input_id>hash_03001420f26e896880c7e819f31c3efcaa6b39</data_input_id>
<t_rra_id></t_rra_id>
<t_rrd_step></t_rrd_step>
<rrd_step>300</rrd_step>
<t_active></t_active>
<active>on</active>
<rra_items></rra_items>
</ds>
<items>
<hash_080014c968c01be21505a29c6d07708f344b77>
<t_data_source_name></t_data_source_name>
<data_source_name>temp</data_source_name>
<t_rrd_minimum></t_rrd_minimum>
<rrd_minimum>0</rrd_minimum>
<t_rrd_maximum></t_rrd_maximum>
<rrd_maximum>100</rrd_maximum>
<t_data_source_type_id>on</t_data_source_type_id>
<data_source_type_id>1</data_source_type_id>
<t_rrd_heartbeat></t_rrd_heartbeat>
<rrd_heartbeat>600</rrd_heartbeat>
<t_data_input_field_id></t_data_input_field_id>
<data_input_field_id>hash_0700149c0660315667ec1d4353bcfaac06e962</data_input_field_id>
</hash_080014c968c01be21505a29c6d07708f344b77>
<hash_08001490353da859ce77c0280cb9eb2af7c4ce>
<t_data_source_name></t_data_source_name>
<data_source_name>amps</data_source_name>
<t_rrd_minimum></t_rrd_minimum>
<rrd_minimum>0</rrd_minimum>
<t_rrd_maximum></t_rrd_maximum>
<rrd_maximum>100</rrd_maximum>
<t_data_source_type_id></t_data_source_type_id>
<data_source_type_id>1</data_source_type_id>
<t_rrd_heartbeat></t_rrd_heartbeat>
<rrd_heartbeat>600</rrd_heartbeat>
<t_data_input_field_id></t_data_input_field_id>
<data_input_field_id>hash_0700148f4514781a15249dec089dda2ebbaf0f</data_input_field_id>
</hash_08001490353da859ce77c0280cb9eb2af7c4ce>
</items>
<data>
<item_000>
<data_input_field_id>hash_0700145250b7445f76ad7c80c42407887e0bc7</data_input_field_id>
<t_value></t_value>
<value></value>
</item_000>
</data>
</hash_01001417b334f3f16bc1d5d9d174d090b11ac5>
<hash_03001420f26e896880c7e819f31c3efcaa6b39>
<name>RPC-Data</name>
<type_id>1</type_id>
<input_string>perl <path_cacti>/scripts/rpcdata.pl <hostname></input_string>
<fields>
<hash_0700149c0660315667ec1d4353bcfaac06e962>
<name>temp</name>
<update_rra>on</update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code></type_code>
<input_output>out</input_output>
<data_name>temp</data_name>
</hash_0700149c0660315667ec1d4353bcfaac06e962>
<hash_0700148f4514781a15249dec089dda2ebbaf0f>
<name>amps</name>
<update_rra>on</update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code></type_code>
<input_output>out</input_output>
<data_name>amps</data_name>
</hash_0700148f4514781a15249dec089dda2ebbaf0f>
<hash_0700145250b7445f76ad7c80c42407887e0bc7>
<name>hostname</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls>on</allow_nulls>
<type_code>hostname</type_code>
<input_output>in</input_output>
<data_name>hostname</data_name>
</hash_0700145250b7445f76ad7c80c42407887e0bc7>
</fields>
</hash_03001420f26e896880c7e819f31c3efcaa6b39>
</cacti>


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

Post by gandalf »

The first version of your script is ok. For the rest, please see first link of my signature. Else, please post screenshots of Data Input Method and Data Template
Reinhard
yardus9
Cacti User
Posts: 77
Joined: Tue Jan 27, 2004 5:32 pm

Post by yardus9 »

ok,
I read through the Howto. Deleted my templates, then re-added. Still getting the same error:

12/20/2007 05:20:05 PM - SPINE: Poller[0] Host[393] PING: Result TCP: Host is Alive
12/20/2007 05:20:05 PM - SPINE: Poller[0] Host[393] Host has no information for recache.
12/20/2007 05:20:05 PM - SPINE: Poller[0] Host[393] DEBUG: The POPEN returned the following File Descriptor 9
12/20/2007 05:20:06 PM - SPINE: Poller[0] Host[393] DS[11357] SCRIPT: perl /web/cacti-0.8.7/scripts/ping.pl 10.5.110.25, output: 1.10
12/20/2007 05:20:06 PM - SPINE: Poller[0] Host[393] DEBUG: The POPEN returned the following File Descriptor 9
12/20/2007 05:20:07 PM - SPINE: Poller[0] Host[393] ERROR: Empty result [rpc1-a1]: 'perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1'
12/20/2007 05:20:07 PM - SPINE: Poller[0] Host[393] DS[11361] WARNING: Result from SCRIPT not valid. Partial Result: ...
12/20/2007 05:20:07 PM - SPINE: Poller[0] Host[393] DS[11361] SCRIPT: perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1, output: U
12/20/2007 05:20:07 PM - SPINE: Poller[0] Host[393] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function

Here is my current script output:
[cacti@nms2 ~]$ perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1
amps:13.5 temp:38.5[cacti@nms2 ~]$

I have attached the screen shots of the templates.

Thanks
Attachments
Data Input Method
Data Input Method
cacshot1.GIF (14.44 KiB) Viewed 5415 times
Data Template
Data Template
cacshot2.GIF (35.65 KiB) Viewed 5415 times
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Yardus9,

In the case of a script, I would return the "\n" as well. It's interesting, the script output looks good, but is bombing under spine. Could it be an environment issue? Not sure on this one. Template looks on track as well.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
yardus9
Cacti User
Posts: 77
Joined: Tue Jan 27, 2004 5:32 pm

Post by yardus9 »

Ok, thanks,
I replaced my rpcdata.pl script with ping.pl in my Data Input Method, and cut my templates down to one variable. That worked, so it does not look like a problem with the templates. I switched it back to my script, cleared the poller cache, and I get the Output:U errors again, even though the output looks the same:

[cacti@nms2 ~]$ perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1
13.6[cacti@nms2 ~]$
[cacti@nms2 ~]$ perl /web/cacti-0.8.7/scripts/ping.pl rpc1-a1
1.11[cacti@nms2 ~]$

So, spine seems to dislike my script.

To test the environment, I set the cacti cron to look like this:

*/5 * * * * php /web/cacti/poller.php > /dev/null 2>&1
*/5 * * * * perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1 >> /home/cacti/rpctestnoprof.txt
*/5 * * * * . /home/cacti/.bash_profile; perl /web/cacti-0.8.7/scripts/rpcdata.pl rpc1-a1 >> /home/cacti/rpctest.txt

The output from the script, with and without giving the profile is the same:
14.114.013.8 ([i]3 samples 14.1 14.0 13.8[/i])

The script uses Net:Telnet, here it is (i am a network guy, excuse any perl blasphemy):

#!/usr/bin/perl
$host = $ARGV[0];

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Binmode=>0,
Input_Log=>'inputlog',
Dump_Log=>'scriptlog',
Errmode=>'die');
## Get the temp/amp from the RPC ##
$telnet->open ("$host.xxx.com") or die("Cannot open");
$telnet->print("1");
$telnet->waitfor('/True RMS current: /i');
@amps = $telnet->waitfor('/ /i');
$telnet->print("1");
$telnet->waitfor('/Internal Temperature: /i');
@temp = $telnet->waitfor('/ /i');
$telnet->print("logout");
$amps = join('',@amps);
$temp = join('',@temp);
$amps =~ s#\s##g;
$temp =~ s#\s##g;
## Print the results ##
##print "amps:$amps temp:$temp";
print $amps;

It seems as though spine does not like this script for some reason. Is there a way to see what output spine is generating , and apparently not liking?


Thanks Again.
yardus9
Cacti User
Posts: 77
Joined: Tue Jan 27, 2004 5:32 pm

Post by yardus9 »

OK,
Problem solved. I ran spine for this host only in an strace,
strace /usr/local/spine/spine -C spine.conf -f 393 -l 393
(BTW- this is a great feature in spine, well done!)

and found my permissions were wrong for the scripts inputlog:
nanosleep({0, 5000000}, problem creating inputlog: Permission denied at /web/cacti-0.8.7/scripts/rpcdata.pl line 5

So I changed my script to place those logs in the cacti log directory.
Just thought I would post this in case somebody else came across the same problem, or if anybody happens to be using these old Baytech PDUs, and wants to use this script to get data.

Thanks for your help cacti team.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Thank you for pointing this out. Permission or $PATH problems are most likely when scripts fail that "run normal" from cli
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests