Ted Cabeen - 2003-12-12

Logged In: YES
user_id=40466

Hey there. I spent some time this afternoon trying to hack
on this feature, since we need it. I think I've got it.
can you look at my patch?

--- bubba_menu.cgi Wed Oct 22 15:48:35 2003
+++ bubba_menu.ted.cgi Fri Dec 12 15:50:20 2003
@@ -713,6 +713,7 @@
push @args, 'CDEF:Nin' . $interface_id . '=in' .
$interface_id . ',UN,0,in' . $interface_id . ',IF',
'CDEF:Nout' . $interface_id . '=out' .
$interface_id . ',UN,0,out' . $interface_id . ',IF';

+
$in_vars .= 'Nin' . $interface_id . ',';
$out_vars .= 'Nout' . $interface_id++ . ',';
$signs .=
$formula_ref->{'interfaces'}->{$interface} . ',';
@@ -723,6 +724,18 @@

# Convert them to bits
push @args, 'CDEF:out_bits=' . $out_vars . $signs .
'8,*';
+
+ # This should calculate the total traffic over the period
+ # Written by Ted Cabeen, ted@impulse.net
+ push @args, 'CDEF:BBBin=PREV,UN,0,PREV,IF,in_bits,+';
+ push @args, 'CDEF:BBBout=PREV,UN,0,PREV,IF,out_bits,+';
+ push @args, 'CDEF:BBBtot=BBBin,BBBout,+';
+ push @args, 'CDEF:BBEin=BBBin,300,*';
+ push @args, 'CDEF:BBEout=BBBout,300,*';
+ push @args, 'CDEF:BBEtot=BBBtot,300,*';
+ push @args, 'CDEF:BEin=BBEin,8,/';
+ push @args, 'CDEF:BEout=BBEout,8,/';
+ push @args, 'CDEF:BEtot=BBEtot,8,/';
}
else {
# Pull from the BUBBA Repository
@@ -763,6 +776,18 @@
'DEF:out1=' . $rate_file . ':' . $out_ds .
':' . $rate_file_cf,
# Convert them to bits
'CDEF:out_bits=out1,8,*';
+
+ # This should calculate the total traffic over the period
+ # Written by Ted Cabeen, ted@impulse.net
+ push @args, 'CDEF:BBBin=PREV,UN,0,PREV,IF,in_bits,+';
+ push @args, 'CDEF:BBBout=PREV,UN,0,PREV,IF,out_bits,+';
+ push @args, 'CDEF:BBBtot=BBBin,BBBout,+';
+ push @args, 'CDEF:BBEin=BBBin,300,*';
+ push @args, 'CDEF:BBEout=BBBout,300,*';
+ push @args, 'CDEF:BBEtot=BBBtot,300,*';
+ push @args, 'CDEF:BEin=BBEin,8,/';
+ push @args, 'CDEF:BEout=BBEout,8,/';
+ push @args, 'CDEF:BEtot=BBEtot,8,/';
}

# Where to find the dummy DS
@@ -961,8 +986,12 @@
}

$field_title =~ s/./ /g;
- push @args, sprintf ('HRULE:%s#FF0000:Contract %s ',
$config_ref->contract_rate, $field_title),
- $rate_display;
+ push @args, sprintf ('HRULE:%s#FF0000:Contract %s ',
$config_ref->contract_rate, $field_title), $rate_display,
'COMMENT:\n', 'COMMENT: ';
+ # This should print the total traffic over the period
+ # Written by Ted Cabeen, ted@impulse.net
+ push @args, 'GPRINT:BEin:MAX:%.0lf bytes in traffic
from averages', 'COMMENT:\n', 'COMMENT: ';
+ push @args, 'GPRINT:BEout:MAX:%.0lf bytes out traffic
from averages', 'COMMENT:\n', 'COMMENT: ';
+ push @args, 'GPRINT:BEtot:MAX:%.0lf bytes total traffic
from averages', 'COMMENT:\n', 'COMMENT: ';

print Dumper($graph_ref, $form_data_ref, \@args,
$rates_ref->{'exclude_ranges'}) if ($form_data_ref->{'_debug'});