Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
Templates, scripts for templates, scripts and requests for templates.
Moderators: Developers , Moderators
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Wed May 21, 2008 9:06 am
Hi all!
I want display the packet size distribution (like ntop plugin) AND the average of this packet size distribution in cacti.
I developed 2 perl script, this is the output:
Code: Select all
monito:/usr/local/cacti/scripts# ./snmp_netflow.pl 172.16.255.105
32:0.1 64:28.3 96:42.1 128:2.3 160:0.8 192:0.6 224:13.7 256:1.2 288:0.2 320:0.2 352:0.2 384:0.3 416:0.3 448:0.7 480:0.3 512:0.3 544:0.2 576:0.2 1024:1.4 1536:5.7 2048:0.0 2560:0.0 3072:0.0 3584:0.0 4096:0.0 4608:0.0
and
Code: Select all
monito:/usr/local/cacti/scripts# ./snmp_average_netflow.pl 172.16.255.105
214.2
After this, I think of I do every thing... (graph template, data source...)
Graphs was created, but they still empty!
The debug in Graph Management:
RRDTool Command:
Code: Select all
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-180 \
--title="CPE-Central - snmp netflow average" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="taillepack" \
DEF:a="/usr/local/cacti/rra/cpecentral_ipaddcpecent_764.rrd":IPADDCPECENT:AVERAGE \
LINE2:a#FF0000:"Moyenne taille paquet"
RRDTool Says:
OK
And I see this in the cacti debug:
Code: Select all
05/21/2008 04:01:58 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/local/rrdtool/bin/rrdtool graph - --imgformat=PNG --start=-86400 --end=-180 --title="CPE-Central - snmp netflow average" --base=1000 --height=120 --width=500 --alt-autoscale-max --lower-limit=0 --vertical-label="taillepack" DEF:a="/usr/local/cacti/rra/cpecentral_ipaddcpecent_764.rrd":IPADDCPECENT:AVERAGE LINE2:a#FF0000:"Moyenne taille paquet"
Someone can help a little?
Thanks in advance![/code]
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Wed May 21, 2008 9:10 am
If someone want my scripts:
Code: Select all
#!/usr/bin/perl
if (!$ARGV[0]){
print "error: Bad argument\n";
print "usage: ./snmp_netflow.pl [IP Address]\n";
exit 1;
}
open(PROCESS, "snmpget -m all -c public -v2c $ARGV[0] cnfPSPacketSizeDistribution.0|");
@snmpget = <PROCESS>;
close(PROCESS);
chomp(@snmpget); # enleve les '\n' a la fin des lignes
my $string = join(" ",@snmpget);
if ($string =~ m/Hex-STRING:(.*)/) {
my $hex = $1;
#print "$hex\n";
my $i = 0;
# Tant que l'on trouve deux nombres (separés par des blancs)
while ($hex =~ m/(\w{2})\s+(\w{2})/g) {
if ($i >= 1024) {
$i = $i + 512;
}
else {
$i += 32;
if ($i == 576+32){
$i = 1024;
}
}
print "$i:" . sprintf("%.1f",hex("$1$2") / 10) . " ";
}
}
and for average:
Code: Select all
#!/usr/bin/perl
if (!$ARGV[0]){
print "error: Bad argument\n";
print "usage: ./snmp_average_netflow.pl [IP Address]\n";
exit 1;
}
open(PROCESS, "snmpget -m all -c public -v2c $ARGV[0] cnfPSPacketSizeDistribution.0|");
@snmpget = <PROCESS>;
close(PROCESS);
chomp(@snmpget); # enleve les '\n' a la fin des lignes
my $string = join(" ",@snmpget);
if ($string =~ m/Hex-STRING:(.*)/) {
my $hex = $1;
my $moy = 0;
my $i = 0;
my $div = 0;
my $hextot= 0;
# Tant que l'on trouve deux nombres (separés par des blancs)
while ($hex =~ m/(\w{2})\s+(\w{2})/g) {
if ($i < 576){
$i += 32;
}
if ($i >= 1024){
$i = $i + 512;
}
if ($i == 577){
$i = 1024;
}
$moy = $moy + $i*(hex("$1$2") / 10);
$hexa = hex("$1$2") / 10;
$hextot=$hextot + $hexa;
if ($i == 576){
$i += 1;
}
}
$final=$moy/$hextot;
print sprintf("%.1f",$final);
}
I hope of I didn't make a mistake for the average calcul!
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Wed May 21, 2008 9:40 am
In the data source debug if found:
Code: Select all
Data Source Debug
/usr/local/rrdtool/bin/rrdtool create \
/usr/local/cacti/rra/cpecentral_ipaddcpecent_764.rrd \
--step 180 \
DS:IPADDCPECENT:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \
It's ok???? I don't understand this debug...
I want juste display the value évolution (min 0, max 4608)...
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Thu May 22, 2008 2:33 am
So, nobody can help me??
Maybe I'm not clear?
or I didn't post in the right place?
Thanks!
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Thu May 22, 2008 10:11 am
when I try to sho my rrd file they are "nan" evry where!
for this script:
Code: Select all
nsp-nms:/usr/local/cacti/scripts#./snmp_netflow.pl 172.16.255.105
32:0.1 64:27.3
And I think of my problem is here:
Code: Select all
nsp-nms:/usr/local/cacti/scripts#rrdtool fetch pod5_32_765.rrd LAST
timestamp 32 64
1211382360: nan nan
1211382540: nan nan
1211382720: nan nan
1211382900: nan nan
1211383080: nan nan
1211383260: nan nan
1211383440: nan nan
1211383620: nan nan
1211383800: nan nan
1211383980: nan nan
1211384160: nan nan
1211384340: nan nan
Please, help!
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Thu May 22, 2008 10:18 am
And I found this command:
Code: Select all
nsp-nms:/usr/local/cacti/rra# rrdtool info pod5_32_765.rrd
filename = "pod5_32_765.rrd"
rrd_version = "0001"
step = 30
last_update = 1211469012
ds[32].type = "GAUGE"
ds[32].minimal_heartbeat = 60
ds[32].min = 0.0000000000e+00
ds[32].max = 1.0000000000e+02
ds[32].last_ds = "UNKN"
ds[32].value = 0.0000000000e+00
ds[32].unknown_sec = 12
ds[64].type = "GAUGE"
ds[64].minimal_heartbeat = 60
ds[64].min = 0.0000000000e+00
ds[64].max = 1.0000000000e+02
ds[64].last_ds = "UNKN"
ds[64].value = 0.0000000000e+00
ds[64].unknown_sec = 12
rra[0].cf = "AVERAGE"
rra[0].rows = 600
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[0].cdp_prep[1].value = NaN
rra[0].cdp_prep[1].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 700
rra[1].pdp_per_row = 6
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 2
rra[1].cdp_prep[1].value = NaN
rra[1].cdp_prep[1].unknown_datapoints = 2
rra[2].cf = "AVERAGE"
rra[2].rows = 775
rra[2].pdp_per_row = 24
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = NaN
rra[2].cdp_prep[0].unknown_datapoints = 20
rra[2].cdp_prep[1].value = NaN
rra[2].cdp_prep[1].unknown_datapoints = 20
rra[3].cf = "AVERAGE"
rra[3].rows = 797
rra[3].pdp_per_row = 288
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = NaN
rra[3].cdp_prep[0].unknown_datapoints = 92
rra[3].cdp_prep[1].value = NaN
rra[3].cdp_prep[1].unknown_datapoints = 92
rra[4].cf = "MIN"
rra[4].rows = 600
rra[4].pdp_per_row = 1
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 0
rra[4].cdp_prep[1].value = NaN
rra[4].cdp_prep[1].unknown_datapoints = 0
rra[5].cf = "MIN"
rra[5].rows = 700
rra[5].pdp_per_row = 6
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = NaN
rra[5].cdp_prep[0].unknown_datapoints = 2
rra[5].cdp_prep[1].value = NaN
rra[5].cdp_prep[1].unknown_datapoints = 2
rra[6].cf = "MIN"
rra[6].rows = 775
rra[6].pdp_per_row = 24
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = NaN
rra[6].cdp_prep[0].unknown_datapoints = 20
rra[6].cdp_prep[1].value = NaN
rra[6].cdp_prep[1].unknown_datapoints = 20
rra[7].cf = "MIN"
rra[7].rows = 797
rra[7].pdp_per_row = 288
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = NaN
rra[7].cdp_prep[0].unknown_datapoints = 92
rra[7].cdp_prep[1].value = NaN
rra[7].cdp_prep[1].unknown_datapoints = 92
rra[8].cf = "MAX"
rra[8].rows = 600
rra[8].pdp_per_row = 1
rra[8].xff = 5.0000000000e-01
rra[8].cdp_prep[0].value = NaN
rra[8].cdp_prep[0].unknown_datapoints = 0
rra[8].cdp_prep[1].value = NaN
rra[8].cdp_prep[1].unknown_datapoints = 0
rra[9].cf = "MAX"
rra[9].rows = 700
rra[9].pdp_per_row = 6
rra[9].xff = 5.0000000000e-01
rra[9].cdp_prep[0].value = NaN
rra[9].cdp_prep[0].unknown_datapoints = 2
rra[9].cdp_prep[1].value = NaN
rra[9].cdp_prep[1].unknown_datapoints = 2
rra[10].cf = "MAX"
rra[10].rows = 775
rra[10].pdp_per_row = 24
rra[10].xff = 5.0000000000e-01
rra[10].cdp_prep[0].value = NaN
rra[10].cdp_prep[0].unknown_datapoints = 20
rra[10].cdp_prep[1].value = NaN
rra[10].cdp_prep[1].unknown_datapoints = 20
rra[11].cf = "MAX"
rra[11].rows = 797
rra[11].pdp_per_row = 288
rra[11].xff = 5.0000000000e-01
rra[11].cdp_prep[0].value = NaN
rra[11].cdp_prep[0].unknown_datapoints = 92
rra[11].cdp_prep[1].value = NaN
rra[11].cdp_prep[1].unknown_datapoints = 92
rra[12].cf = "LAST"
rra[12].rows = 600
rra[12].pdp_per_row = 1
rra[12].xff = 5.0000000000e-01
rra[12].cdp_prep[0].value = NaN
rra[12].cdp_prep[0].unknown_datapoints = 0
rra[12].cdp_prep[1].value = NaN
rra[12].cdp_prep[1].unknown_datapoints = 0
rra[13].cf = "LAST"
rra[13].rows = 700
rra[13].pdp_per_row = 6
rra[13].xff = 5.0000000000e-01
rra[13].cdp_prep[0].value = NaN
rra[13].cdp_prep[0].unknown_datapoints = 2
rra[13].cdp_prep[1].value = NaN
rra[13].cdp_prep[1].unknown_datapoints = 2
rra[14].cf = "LAST"
rra[14].rows = 775
rra[14].pdp_per_row = 24
rra[14].xff = 5.0000000000e-01
rra[14].cdp_prep[0].value = NaN
rra[14].cdp_prep[0].unknown_datapoints = 20
rra[14].cdp_prep[1].value = NaN
rra[14].cdp_prep[1].unknown_datapoints = 20
rra[15].cf = "LAST"
rra[15].rows = 797
rra[15].pdp_per_row = 288
rra[15].xff = 5.0000000000e-01
rra[15].cdp_prep[0].value = NaN
rra[15].cdp_prep[0].unknown_datapoints = 92
rra[15].cdp_prep[1].value = NaN
rra[15].cdp_prep[1].unknown_datapoints = 92
This can help you?
I see value = NaN, this want say of my script is wrong??
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Thu May 22, 2008 10:48 am
I try to change my scrip for decimal number and not float.
But it's the same problem my rrd is full of NaN
Code: Select all
nsp-nms:/usr/local/cacti/scripts#./snmp_netflow.pl 172.16.255.105
32:0 64:27nsp-nms:/usr/local/cacti/scripts#
Tarsinion
Posts: 7 Joined: Thu May 22, 2008 11:18 am
Post
by Tarsinion » Fri May 23, 2008 2:51 am
sorry, i do not have a solution but the same problem. just got "nan" in my graphs ...
Just found this, it might be a help:
http://docs.cacti.net/node/283
Edit: The solution for me was the wrong path to the script. i've installed the php file to /var/www/site/cacti/scripts/ but he was always looking for
/usr/share/cacti/site/scripts/
Thanks for the FAQ to the developer
. Sometimes reading helps hehe
taytay06
Posts: 10 Joined: Mon Mar 10, 2008 11:32 am
Post
by taytay06 » Fri May 23, 2008 8:08 am
Thank for this link,
I read it...
But I have already the same issue...
And the path for my script is the good path.
Thanks
Maybe my outpout is bad??
What do you think about (without /n at the end):
32:0 64:27
this want said 0% of 32 bytes packet and 27% of 64 bytes packet?
Users browsing this forum: No registered users and 3 guests