mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
adding ARP table display to port list and port page
git-svn-id: http://www.observium.org/svn/observer/trunk@526 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D";
|
||||
$sql .= " WHERE I.ifAlias like 'Cust: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
$sql .= " WHERE I.ifAlias like 'Cust: %' AND I.device_id = D.device_id ORDER BY I.ifAlias,D.hostname";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
@@ -42,10 +42,10 @@
|
||||
} else {
|
||||
if(isset($prev_customer)) {
|
||||
echo("<tr bgcolor='$bg_colour'><td></td><td colspan=6>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=$day&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=$week&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=$month&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=$year&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($prev_customer)."&type=customer_bits&from=$day&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($prev_customer)."&type=customer_bits&from=$week&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($prev_customer)."&type=customer_bits&from=$month&to=$now&width=215&height=100'>
|
||||
<img src='".$config['base_url']."/graph.php?cust=".rawurlencode($prev_customer)."&type=customer_bits&from=$year&to=$now&width=215&height=100'>
|
||||
</td></tr>");
|
||||
}
|
||||
|
||||
|
||||
32
html/pages/device/arp.inc.php
Normal file
32
html/pages/device/arp.inc.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM ipv4_mac AS M, interfaces AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
|
||||
while($arp = mysql_fetch_array($query)) {
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
|
||||
if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); }
|
||||
if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); }
|
||||
|
||||
if($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; }
|
||||
if($arp_host['interface_id'] == $arp['interface_id']) { $arp_if = "Local Port"; }
|
||||
|
||||
echo("
|
||||
<tr bgcolor=$bg_colour>
|
||||
<td width=200><b>".generateiflink(array_merge($arp, $device))."</b></td>
|
||||
<td width=160>".formatmac($arp['mac_address'])."</td>
|
||||
<td width=140>".$arp['ipv4_address']."</td>
|
||||
<td width=200>$arp_name</td>
|
||||
<td>$arp_if</td>
|
||||
</tr>");
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
31
html/pages/device/port/arp.inc.php
Normal file
31
html/pages/device/port/arp.inc.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?
|
||||
|
||||
$sql = "SELECT * FROM ipv4_mac WHERE interface_id = '".$interface['interface_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
|
||||
while($arp = mysql_fetch_array($query)) {
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
|
||||
if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); }
|
||||
if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); }
|
||||
|
||||
if($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; }
|
||||
if($arp_host['interface_id'] == $arp['interface_id']) { $arp_if = "Local Port"; }
|
||||
|
||||
echo("
|
||||
<tr bgcolor=$bg_colour>
|
||||
<td width=160>".formatmac($arp['mac_address'])."</td>
|
||||
<td width=140>".$arp['ipv4_address']."</td>
|
||||
<td width=200>$arp_name</td>
|
||||
<td>$arp_if</td>
|
||||
</tr>");
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user