Cacti Perl Script Direct Output

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

Moderators: Developers, Moderators

Post Reply
wannabeRootGod
Posts: 1
Joined: Thu Oct 15, 2015 1:22 pm

Cacti Perl Script Direct Output

Post by wannabeRootGod »

I am trying to create a graph from the direct output of a perl script. It logs in to a network device and pulls info via Net::Telnet, and has 3 variables it returns, 1 i would like to be informational and not graph just represent as it is the port number and won't change. The three variables are
Port: TxPower: RxPower

the script returns output from the result of running spine manually
/usr/local/spine/bin/spine --verbosity=5 9 9

10/15/2015 02:49:38 PM - SPINE: Poller[0] Host[9] TH[1] DS[77] SCRIPT: /usr/bin/perl /usr/share/cacti/site/scripts/Show_Optic.pl 10.0.2.2 tanner gotcha 7, output: Port:7 RxPower:214.3647 TxPower:002.9242

and adds information to the poller_output table in mysql

i am using spine/ubuntu/cacti version 0.8.7i

but the debug of the cacti.log says it returns a output: U from the result of the script and i am at a loss on how to trouble shoot this any further. Wondering if this is possible, i think it should be. Any help would be appreciated
Attachments
Data template
Data template
datatemplate.png (131.04 KiB) Viewed 797 times
data input method
data input method
DataInputMethod.png (99.61 KiB) Viewed 797 times
cacti poller debug output log.txt
here is a log of the poller debug
(23.75 KiB) Downloaded 115 times
silvertip257
Posts: 33
Joined: Sun Mar 25, 2012 12:22 pm

Re: Cacti Perl Script Direct Output

Post by silvertip257 »

wannabeRootGod wrote:I am trying to create a graph from the direct output of a perl script. It logs in to a network device and pulls info via Net::Telnet, and has 3 variables it returns, 1 i would like to be informational and not graph just represent as it is the port number and won't change. The three variables are
I don't believe it's possible to reference Data Input Method values in a graph (but it would be awesome if we could).
Even if you were to use a script query, it would be a massive rewrite of your script to properly handle indexing the data. If you were to do that, you could use |query| variables to reference data in the SNMP Cache.
wannabeRootGod wrote: Port: TxPower: RxPower

the script returns output from the result of running spine manually
/usr/local/spine/bin/spine --verbosity=5 9 9

10/15/2015 02:49:38 PM - SPINE: Poller[0] Host[9] TH[1] DS[77] SCRIPT: /usr/bin/perl /usr/share/cacti/site/scripts/Show_Optic.pl 10.0.2.2 tanner gotcha 7, output: Port:7 RxPower:214.3647 TxPower:002.9242

and adds information to the poller_output table in mysql

i am using spine/ubuntu/cacti version 0.8.7i

but the debug of the cacti.log says it returns a output: U from the result of the script and i am at a loss on how to trouble shoot this any further. Wondering if this is possible, i think it should be. Any help would be appreciated
If your script works by hand, from both CLI and from CLI through spine then it should be just fine.
Is anything timing out or taking a long time to respond, which might result in a U return value?
silvertip257
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cacti Perl Script Direct Output

Post by BSOD2600 »

silvertip257 wrote:
wannabeRootGod wrote:I am trying to create a graph from the direct output of a perl script. It logs in to a network device and pulls info via Net::Telnet, and has 3 variables it returns, 1 i would like to be informational and not graph just represent as it is the port number and won't change. The three variables are
I don't believe it's possible to reference Data Input Method values in a graph (but it would be awesome if we could).
Even if you were to use a script query, it would be a massive rewrite of your script to properly handle indexing the data. If you were to do that, you could use |query| variables to reference data in the SNMP Cache.
Either the SNMP or Script Data queries can be used for displaying static data in graphs http://docs.cacti.net/manual:088:3a_adv ... alkthrough
wannabeRootGod wrote: Port: TxPower: RxPower

the script returns output from the result of running spine manually
/usr/local/spine/bin/spine --verbosity=5 9 9

10/15/2015 02:49:38 PM - SPINE: Poller[0] Host[9] TH[1] DS[77] SCRIPT: /usr/bin/perl /usr/share/cacti/site/scripts/Show_Optic.pl 10.0.2.2 tanner gotcha 7, output: Port:7 RxPower:214.3647 TxPower:002.9242
1) Cacti 0.8.8f is the latest which has a ton of features/bugs/security fixes. should strongly consider about upgrading.
2) Increase the poller logging level to high or debug for a single cycle. Look in the log around when the Show_Optic.pl runs for any other info.
3) Temporarily switch to cmd.php poller to check if that properly parses the Show_Optic.pl output. Offhand looks like its correctly formatted.
silvertip257
Posts: 33
Joined: Sun Mar 25, 2012 12:22 pm

Re: Cacti Perl Script Direct Output

Post by silvertip257 »

BSOD2600 wrote:
silvertip257 wrote:
wannabeRootGod wrote:I am trying to create a graph from the direct output of a perl script. It logs in to a network device and pulls info via Net::Telnet, and has 3 variables it returns, 1 i would like to be informational and not graph just represent as it is the port number and won't change. The three variables are
I don't believe it's possible to reference Data Input Method values in a graph (but it would be awesome if we could).
Even if you were to use a script query, it would be a massive rewrite of your script to properly handle indexing the data. If you were to do that, you could use |query| variables to reference data in the SNMP Cache.
Either the SNMP or Script Data queries can be used for displaying static data in graphs http://docs.cacti.net/manual:088:3a_adv ... alkthrough

...trimmed...
My statement was a bit vague.
BSOD2600 is right, one can use SNMP Data Query or Script Queries to retrieve data.

What I meant to say was that [I don't believe there is] direct access to Data Input Method parameters without creating an RRA.
If it is possible that would give wannabeRootGod the ability to reference the port parameter in his graph (without having to re-gather data that was already used as a parameter).

;) Script Query is the way.

Retrieving static values from the SNMP Cache is possible once a Data Query is created (does not create an RRA file). Make sure to set the Data Query field as an input field (via |query| variables - see Data Query Fields section). If you intend to create a Data Template (and store values in RRAs) as well, you need two fields (one for each direction type of input/output).
silvertip257
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest