Added aggregate config option to Billing 95th percentile calculations (#10202)

* Added configuration options to aggregate input and output bits before making 95th percentile billing calculations

* Changed aggregate to per-bill instead of global.  Added config options for making aggregate the default selected option.  Refactored out mres() calls in touched files.  Changed to Config::get where appropriate.

* Fixed documentation typo

* Fixed scope of aggregate default config option to be under billing
This commit is contained in:
Llarian
2019-05-27 19:44:02 -07:00
committed by Tony Murray
parent 38a638358d
commit 9c837bee87
7 changed files with 101 additions and 39 deletions

View File

@@ -12,6 +12,7 @@
*/
use LibreNMS\Authentication\LegacyAuth;
use LibreNMS\Config;
if (LegacyAuth::user()->hasGlobalAdmin()) {
require 'includes/html/javascript-interfacepicker.inc.php';
@@ -73,6 +74,11 @@ if (LegacyAuth::user()->hasGlobalAdmin()) {
<?php
if (Config::get('billing.95th_default_agg') == 1) {
$bill_data['dir_95th'] = 'agg';
} else {
$bill_data['dir_95th'] = 'in';
}
$bill_data['bill_type'] = 'cdr';
$quota = array('select_gb' => ' selected');
$cdr = array('select_mbps' => ' selected');

View File

@@ -84,6 +84,7 @@ if ($_POST['action'] == 'update_bill') {
'bill_quota' => (string)$bill_quota,
'bill_cdr' => (string)$bill_cdr,
'bill_type' => $_POST['bill_type'],
'dir_95th' => $_POST['dir_95th'],
'bill_custid' => $_POST['bill_custid'],
'bill_ref' => $_POST['bill_ref'],
'bill_notes' => $_POST['bill_notes'],

View File

@@ -39,6 +39,25 @@
<option <?php echo $cdr['select_gbps'] ?> value="Gbps">Gigabits per second (Gbps)</option>
</select>
</div>
<label class="col-sm-4 control-label" for="dir_95th">95th Calculation</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="dir_95th" id="dir_95th_inout" value="in"
<?php
if ($bill_data['dir_95th'] == 'in' || $bill_data['dir_95th'] == 'out') {
echo "checked";
}
?> /> Max In/Out
</label>
<label class="radio-inline">
<input type="radio" name="dir_95th" id="dir_95th_agg" value="agg"
<?php
if ($bill_data['dir_95th'] == 'agg') {
echo "checked";
}
?> /> Aggregate
</label>
</div>
</div>
<div id="quotaDiv">
<label class="col-sm-4 control-label" for="bill_quota">Quota</label>

View File

@@ -64,7 +64,7 @@ if ($_POST['addbill'] == 'yes') {
'rate_95th_in' => 0,
'rate_95th_out' => 0,
'rate_95th' => 0,
'dir_95th' => 'in',
'dir_95th' => $_POST['dir_95th'],
'total_data' => 0,
'total_data_in' => 0,
'total_data_out' => 0,