I am quite new to CACTI so I might ask some obvious questions
What I need to do is graph modulation type of a wireless link (Alvarion WiMAX CPE).
I get the data via SNMP and this is great, but the result is a string like: "QAM64-5/6", so afaik there is no way of putting it on graph.
Some time ago i have managed to make a script which associated my SNMP gathered strings with numbers 0-9 and it works fine.
Then manually i have managed to place the data in RRD and create graphs, run all in crontab and voila:
Now I want to move this to CACTI, I have created another script so the gathered data is integer 1-9.
I have created a data input method, data template and graph template according to http://forums.cacti.net/viewtopic.php?t=11288 on other tutorials.
but all i get is NaN on my graph... even found an exapmle with script that generates random data, but i get the same NaN.
Tested the script in shell and it gets the data as planned, when the user is switched to 'cacti' it also works.
Tried to look for hints in the log, but unfortunatelly did not find any... probably my lack of knowledge.
Any help would be much appreciated. Maybe there is another way of doing this?
Cacti 0.8.8.a with spine + some plugins
Running on FreeBSD 9.0
Below is my setup.
Script:
(just started learning perl )
Code: Select all
#!/usr/bin/perl
use warnings;
use Getopt::Long;
use POSIX;
my $snmp_timeout = "5";
my $read_community = "public";
$target_ip = $ARGV[0];
sub modtoval() {
#replace strings with integer values
if ($_[0] eq "qpsk-ctc-1/2 4 repetitions"){$_[0] = 1}
elsif ($_[0] eq "qpsk-ctc-1/2 2 repetitions"){$_[0] = 2}
elsif ($_[0] eq "qpsk-ctc-1/2"){$_[0] = 3}
elsif ($_[0] eq "qpsk-ctc-3/4"){$_[0] = 4}
elsif ($_[0] eq "qam16-ctc-1/2"){$_[0] = 5}
elsif ($_[0] eq "qam16-ctc-3/4"){$_[0] = 6}
elsif ($_[0] eq "qam64-ctc-2/3"){$_[0] = 7}
elsif ($_[0] eq "qam64-ctc-3/4"){$_[0] = 8}
elsif ($_[0] eq "qam64-ctc-5/6"){$_[0] = 9}
}
#SNMP Query
my $downmod= `/usr/local/bin/snmpget -t $snmp_timeout -v 1 -c $read_community -Oqv $target_ip 1.3.6.1.4.1.10529.300.1.1.6.0`;
my $upmod= `/usr/local/bin/snmpget -t $snmp_timeout -v 1 -c $read_community -Oqv $target_ip 1.3.6.1.4.1.10529.300.1.1.5.0`;
#strip unnecessary
$upmod =~ m/"(.+?)"/;
$upmod = $1;
$downmod =~ m/"(.+?)"/;
$downmod = $1;
#replace strings with ints
$downmod = &modtoval($downmod);
$upmod = &modtoval($upmod);
#print data
print "down_mod:" . $downmod . " up_mod:" . $upmod;