From fa0f3a3dd8919c122ac0b981391f873c0e20192f Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 19 Nov 2009 19:16:01 +0000 Subject: [PATCH] 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 --- html/pages/customers.php | 10 +++++----- html/pages/device/arp.inc.php | 32 ++++++++++++++++++++++++++++++ html/pages/device/port/arp.inc.php | 31 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 html/pages/device/arp.inc.php create mode 100644 html/pages/device/port/arp.inc.php diff --git a/html/pages/customers.php b/html/pages/customers.php index b5c539c03..36e1b8ea7 100644 --- a/html/pages/customers.php +++ b/html/pages/customers.php @@ -1,7 +1,7 @@ - - - - + + + + "); } diff --git a/html/pages/device/arp.inc.php b/html/pages/device/arp.inc.php new file mode 100644 index 000000000..135e4e881 --- /dev/null +++ b/html/pages/device/arp.inc.php @@ -0,0 +1,32 @@ +"); +$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(" + + ".generateiflink(array_merge($arp, $device))." + ".formatmac($arp['mac_address'])." + ".$arp['ipv4_address']." + $arp_name + $arp_if + "); + $i++; +} + +echo(""); + +?> diff --git a/html/pages/device/port/arp.inc.php b/html/pages/device/port/arp.inc.php new file mode 100644 index 000000000..9c8113145 --- /dev/null +++ b/html/pages/device/port/arp.inc.php @@ -0,0 +1,31 @@ +"); +$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(" + + ".formatmac($arp['mac_address'])." + ".$arp['ipv4_address']." + $arp_name + $arp_if + "); + $i++; +} + +echo(""); + +?>