initial commit; version 22.5.12042

This commit is contained in:
2022-12-12 23:28:25 -05:00
commit af1b03d79f
17653 changed files with 22692970 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill
//include("../includes/billing.inc.php");
if (is_numeric($vars['id']) && ($auth || bill_permitted($vars['id'])))
{
$bill = dbFetchRow("SELECT * FROM `bills` WHERE `bill_id` = ?", array($vars['id']));
$datefrom = date('YmdHis', $vars['from']);
$dateto = date('YmdHis', $vars['to']);
$rates = getRates($vars['id'], $datefrom, $dateto);
$ports = dbFetchRows("SELECT * FROM `bill_entities` AS B, `ports` AS P, `devices` AS D WHERE B.`bill_id` = ? AND P.`port_id` = B.`entity_id` AND D.`device_id` = P.`device_id`", array($vars['id']));
$auth = TRUE;
}
// EOF

View File

@ -0,0 +1,60 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// Generate a list of ports and then call the multi_bits grapher to generate from the list
$i = 0;
foreach ($ports as $port)
{
// $device and $port are retrieved from the same query
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
if (rrd_is_file($rrdfile))
{
$rrd_list[$i]['filename'] = $rrdfile;
$rrd_list[$i]['descr'] = $port['hostname'];
$rrd_list[$i]['descr_out'] = $port['ifDescr'];
if (isset($port['ifAlias']) && $port['ifAlias'] != $port['ifDescr'])
{
$rrd_list[$i]['descr_out'] .= ' ('.$port['ifAlias'].')';
}
$i++;
}
}
$units='bps';
$total_units='B';
$colours_in='greens';
$multiplier = "8";
$colours_out = 'blues';
$nototal = 1;
$ds_in = "INOCTETS";
$ds_out = "OUTOCTETS";
#print_vars($rates);
if($bill['bill_type'] == "cdr") {
$custom_graph = " COMMENT:'\\r' ";
$custom_graph .= " HRULE:" . $rates['rate_95th'] . "#cc0000:'95th %ile \: ".formatRates($rates['rate_95th'])." (".$rates['dir_95th'].") (CDR\: ".formatRates($bill['bill_cdr']).")'";
$custom_graph .= " HRULE:" . $rates['rate_95th'] * -1 . "#cc0000";
} elseif($bill['bill_type'] == "quota") {
$custom_graph = " COMMENT:'\\r' ";
$custom_graph .= " HRULE:" . $rates['rate_average'] . "#cc0000:'Usage \: ".format_bytes_billing($rates['total_data'])." (".formatRates($rates['rate_average']).")'";
$custom_graph .= " HRULE:" . $rates['rate_average'] * -1 . "#cc0000";
}
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
?>