mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
improve mac accounting (why was it in port? am i mental?)
git-svn-id: http://www.observium.org/svn/observer/trunk@2201 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
if (is_numeric($id))
|
||||
{
|
||||
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
|
||||
$acc = mysql_fetch_assoc($query);
|
||||
|
||||
if (($config['allow_unauth_graphs'] || port_permitted($acc['interface_id']))
|
||||
&& is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||
|
||||
$port = get_port_by_id($acc['interface_id']);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
$title = generate_device_link($device);
|
||||
$title .= " :: Port ".generate_port_link($port);
|
||||
$title .= " :: " . $acc['mac'];
|
||||
$auth = TRUE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,17 +1,8 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
|
||||
$acc = mysql_fetch_assoc($query);
|
||||
if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/". safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||
}
|
||||
|
||||
$rra_in = "IN";
|
||||
$rra_out = "OUT";
|
||||
|
||||
include("includes/graphs/generic_bits.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
|
||||
$acc = mysql_fetch_assoc($query);
|
||||
if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||
}
|
||||
|
||||
$rra_in = "PIN";
|
||||
$rra_out = "POUT";
|
||||
|
||||
@@ -25,4 +16,4 @@ $unit_text = "Pkts\ \ \ ";
|
||||
|
||||
include("includes/graphs/generic_duplex.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -154,9 +154,9 @@ if ($_GET['optd'] == "top10")
|
||||
|
||||
if ($_GET['optc'])
|
||||
{
|
||||
$graph_type = "port_mac_acc_" . $_GET['optc'];
|
||||
$graph_type = "macaccounting_" . $_GET['optc'];
|
||||
} else {
|
||||
$graph_type = "port_mac_acc_bits";
|
||||
$graph_type = "macaccounting_bits";
|
||||
}
|
||||
|
||||
if ($_GET['optd'] == "thumbs")
|
||||
|
||||
@@ -182,7 +182,7 @@ else
|
||||
{
|
||||
case 'macaccounting_bits':
|
||||
case 'macaccounting_pkts':
|
||||
$acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, ports AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id"));
|
||||
$acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id"));
|
||||
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
if (is_array($acc) && is_file($database))
|
||||
{
|
||||
@@ -199,8 +199,6 @@ else
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "220";
|
||||
$graph_array['to'] = $now;
|
||||
# $graph_array['type'] = "bgp_" . $_GET['optc'];
|
||||
# $graph_array['id'] = $peer['bgpPeer_id'];
|
||||
echo('<tr bgcolor="'.$bg_colour.'"' . ($bg_image ? ' background="'.$bg_image.'"' : '') . '"><td colspan="9">');
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
Reference in New Issue
Block a user