[Solved]Yet another nan problem

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

Moderators: Developers, Moderators

Post Reply
jeffvoice
Posts: 6
Joined: Mon Jul 23, 2012 1:18 pm

[Solved]Yet another nan problem

Post by jeffvoice »

OK, first things first, I've gone through all the debugging steps that are listed.
I've tweaked and re-tweaked just about everything to do with this particular graph but I can't get any data.

The Problem:
I have a script that prints data, and running the script as is I get output,

Code: Select all

perl /var/www/cacti/scripts/do_ul_stats.pl 
Users: 21669
Contacts: 23732
Deleted: 1634348
Expired: 1422781
TCP-Contacts: 9940
TCP-Deleted: 95194
TCP-Expired: 354329
However the graph still shows nan for all those values. Here's the debugging info:

Code: Select all

07/23/2012 12:25:39 PM - SPINE: Poller[0] Host[104] TH[1] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
07/23/2012 12:25:39 PM - SPINE: Poller[0] Host[104] TH[1] Total Time: 5.5 Seconds
07/23/2012 12:25:39 PM - SPINE: Poller[0] Host[104] TH[1] DS[2848] SCRIPT: /var/www/cacti/scripts/do_ul_stats.pl, output: U
07/23/2012 12:25:39 PM - SPINE: Poller[0] Host[104] ERROR: Empty result [dbpstat.wvp.vivox.com]: '/var/www/cacti/scripts/do_ul_stats.pl'
I've tried everything from the troubleshooting page, but I'm more than willing to try anything that you guys advise.

Thanks for your time, and let me know if you need more info.


PS: Here's the script in case that's necessary.

Code: Select all


#!/usr/bin/perl -w

use Data::Dumper;
#change server names *****
open(STATS, "echo 'xserctl|fifo ul_stats|xxx.company.com' | nc proxy.xxx.company.com 6668 |");
my $hdr = <STATS>;
if ($hdr =~ /^Ack|0|0|/) {
   $hdr =~ s/^Ack\|0\|0\|//;
   @flds = split(' ', $hdr);
} else {
   print "Failed to get stats!\r\n";
   exit 1;
}

while (<STATS>) {
    if (/^'location'/) {
      @vals = split ' ';
    }
}

if (!defined(@vals)) {
   print "Failed to get stats!\r\n";
   exit 1;
}

# Build field name -> index mapping
my %index;
@index{@flds} = (0..$#flds);
my $delidx = $index{'Deleted'};
print "Users: ".$vals[$index{'Users'}] . "\r\n";
print "Contacts: ".$vals[$index{'Contacts'}] . "\r\n";
print "Deleted: ".$vals[$index{'Deleted'}] . "\r\n";
print "Expired: ".$vals[$index{'Expired'}] . "\r\n";
print "TCP-Contacts: ".$vals[$index{'TCP-Contacts'}] . "\r\n";
print "TCP-Deleted: ".$vals[$index{'TCP-Deleted'}] . "\r\n";
print "TCP-Expired: ".$vals[$index{'TCP-Expired'}] . "\r\n";
Last edited by jeffvoice on Tue Jul 24, 2012 6:39 pm, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Yet another nan problem

Post by gandalf »

As advised at 2nd link of my sig, only do a single print and all output on a single line, space delimited, please
R.
jeffvoice
Posts: 6
Joined: Mon Jul 23, 2012 1:18 pm

Re: Yet another nan problem

Post by jeffvoice »

Yeah that's the debugging process I had already followed.
Updated the print statement and still get an empty result. It is formatted like one of my other scripts that graphs perfectly fine.

Code: Select all

07/23/2012 05:24:49 PM - SPINE: Poller[0] Host[104] ERROR: Empty result [dbpstat.wvp.vivox.com]: '/var/www/cacti/scripts/do_ul_stats.pl'
07/23/2012 05:24:49 PM - SPINE: Poller[0] Host[104] TH[1] DS[2848] SCRIPT: /var/www/cacti/scripts/do_ul_stats.pl, output: U
Thanks for the reply though. I'll keep troubleshooting.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Yet another nan problem

Post by gandalf »

Well, at least when running spine, you should always put in full/path/to/everything as there is no meaningful $PATH available
R.
jeffvoice
Posts: 6
Joined: Mon Jul 23, 2012 1:18 pm

Re: Yet another nan problem

Post by jeffvoice »

Well I solved the fact that the output was U. Turns out it was a permission problem, I had to run it was verbosity=10 to see that.

Just chmod the script and started getting output.
Now I have another problem, which I'm assuming is the order of the output. Only 1 of the values is actually making it to the graph, the rest show up nan.

I shall continue to debug. But anything you could suggest outside that link would be greatly appreciated.

Thanks

-J
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Yet another nan problem

Post by BSOD2600 »

jeffvoice wrote:But anything you could suggest outside that link would be greatly appreciated.
Forget to enable the rest of the output items in your Data Input Method?
jeffvoice
Posts: 6
Joined: Mon Jul 23, 2012 1:18 pm

Re: Yet another nan problem

Post by jeffvoice »

Nope, had them mislabeled :oops:
Thanks for your help I'll change this to solved
-J
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests