mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
improve billing graphs a little
git-svn-id: http://www.observium.org/svn/observer/trunk@1961 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,14 +2,29 @@
|
|||||||
|
|
||||||
### Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill
|
### Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill
|
||||||
|
|
||||||
|
include("../includes/billing.php");
|
||||||
|
include("../includes/functions.php"); ## FIXME zeropad()
|
||||||
|
|
||||||
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted($_GET['id'])))
|
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted($_GET['id'])))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$bill_query = mysql_query("SELECT * FROM `bills` WHERE bill_id = '".mres($_GET['id'])."'");
|
||||||
|
$bill = mysql_fetch_assoc($bill_query);
|
||||||
|
|
||||||
|
$day_data = getDates($bill['bill_day']);
|
||||||
|
$datefrom = $day_data['0'];
|
||||||
|
$dateto = $day_data['1'];
|
||||||
|
|
||||||
|
$rates = getRates($_GET['id'], $datefrom, $dateto);
|
||||||
|
|
||||||
$ports = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
$ports = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
|
||||||
WHERE B.bill_id = '".mres($_GET['id'])."' AND P.interface_id = B.port_id
|
WHERE B.bill_id = '".mres($_GET['id'])."' AND P.interface_id = B.port_id
|
||||||
AND D.device_id = P.device_id");
|
AND D.device_id = P.device_id");
|
||||||
|
|
||||||
$auth = TRUE;
|
$auth = TRUE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -24,6 +24,19 @@ $nototal = 1;
|
|||||||
$rra_in = "INOCTETS";
|
$rra_in = "INOCTETS";
|
||||||
$rra_out = "OUTOCTETS";
|
$rra_out = "OUTOCTETS";
|
||||||
|
|
||||||
|
#print_r($rates);
|
||||||
|
|
||||||
|
if($bill['bill_type'] == "cdr") {
|
||||||
|
$custom_graph = " COMMENT:'\\r' ";
|
||||||
|
$custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 . "#cc0000:'95th %ile \: ".formatRates($rates['rate_95th']*1000)." (".$rates['dir_95th'].") (CDR\: ".formatRates($rates['bill_cdr']*1000).")'";
|
||||||
|
$custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 * -1 . "#cc0000";
|
||||||
|
} elseif($bill['bill_type'] == "quota") {
|
||||||
|
$custom_graph = " COMMENT:'\\r' ";
|
||||||
|
$custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 . "#cc0000:'Usage \: ".formatStorage($rates['total_data']*1024*1024)." (".formatRates($rates['rate_average']*1000).")'";
|
||||||
|
$custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 * -1 . "#cc0000";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
include("includes/graphs/generic_multi_bits_separated.inc.php");
|
include("includes/graphs/generic_multi_bits_separated.inc.php");
|
||||||
|
|
||||||
?>
|
?>
|
@@ -54,6 +54,8 @@ foreach ($rrd_list as $rrd)
|
|||||||
$i++; $iter++;
|
$i++; $iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($custom_graph) { $rrd_options .= $custom_graph; }
|
||||||
|
|
||||||
$rrd_options .= $rrd_optionsb;
|
$rrd_options .= $rrd_optionsb;
|
||||||
$rrd_options .= " HRULE:0#999999";
|
$rrd_options .= " HRULE:0#999999";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user