Yes I know,
"DEF:in=$rrd_file:traffic_in:AVERAGE:step=1",
"DEF:out=$rrd_file:traffic_out:AVERAGE:step=1",
'CDEF:bitin=in,8,*',
'CDEF:bitout=out,8,*',
'CDEF:total=bitin,bitout,+',
'VDEF:pct_total=total,95,PERCENT',
'VDEF:pct_in=bitin,95,PERCENT',
'VDEF:pct_out=bitout,95,PERCENT',
To get In, Out and a 95th(In+Out).
But 95th(In+Out) although correct for what it is, it's not what I need as a total 95th.
I need it the conventional In values and Out values together "flattened" and 95th calculated off that. So that if 1 link is doing mostly Inbound with big In spikes this better 95th percentile will be a number closer to the average Inbound traffic, because most/all the top spikes will be inbound traffic outbound doesnt factor in much in the total usage. And similarly link 2 does mostly Outbound this 95th percentile would be a number closer to the Outbound average traffic.
Is there a way to do that with RRDtools alone at all, similar to the above command parameters?
In perl I've done something (dirty) like that but I don't align the time window (-a
is not recognised by rrdtool fetch
as a parameter) and for longer periods of time (say a month) I get few samples, so some reconciliation is hidden from me;
my ($start, $end, $rrd_file) = @_;
my @series = `rrdtool fetch -s $start -e $end $rrd_file MAX`;
my @all;
foreach my $line (@series) {
if ($line !~ m/nan/ig && $line =~ m/(\d+): (\S+) (\S+)/) {
my ($time, $in, $out) = ($1, $2, $3);
push(@all, $in * 8, $out * 8);
}
}
@all = sort {$b <=> $a} @all;
my $index_all = int(scalar(@all) * 0.05) + 1;
return sprintf("%.2f", $all[$index_all] / 1000 / 1000);
where
my $end = DateTime->now(time_zone => 'local')->truncate(to => 'minute');
my $start = $end->clone->subtract(hours => 168)->epoch();
$end = $end->epoch();