From 1ea54588ebc8be4fbf2301cae3b47188689b0af0 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 5 Aug 2009 16:05:14 +0000 Subject: [PATCH] git-svn-id: http://www.observium.org/svn/observer/trunk@442 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/device/ciscosensors.inc.php | 2 +- html/pages/device/ports.inc.php | 37 ++++++----- html/pages/device/vlans.inc.php | 9 +++ html/pages/device/vrfs.inc.php | 10 +++ html/pages/ipv4.php | 92 ++++++++++++++++++++++++++ html/pages/ipv6.php | 92 ++++++++++++++++++++++++++ html/pages/vrfs.php | 24 ++++++- 7 files changed, 244 insertions(+), 22 deletions(-) create mode 100644 html/pages/ipv4.php create mode 100644 html/pages/ipv6.php diff --git a/html/pages/device/ciscosensors.inc.php b/html/pages/device/ciscosensors.inc.php index 559ec03b5d..0cda5aec08 100644 --- a/html/pages/device/ciscosensors.inc.php +++ b/html/pages/device/ciscosensors.inc.php @@ -1,6 +1,6 @@ "); + echo("
"); unset ($sep); $query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`"); while($data = mysql_fetch_array($query)) { diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index 682bf2400e..e24829e4e9 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -1,23 +1,34 @@ +
Basic | Details | Graphs: Bits -(Compact) | -Packets | -NU Packets | +(Mini) | +Packets +(Mini) | +NU Packets +(Mini) | Errors +(Mini)
"); +if($_GET['opta'] == graphs ) { + if($_GET['optb']) { + $graph_type = $_GET['optb']; + } else { + $graph_type = "bits"; + } + $dographs = 1; +} + if($_GET['optc'] == thumbs) { $timeperiods = array('-1day','-1week','-1month','-1year'); $from = '-1day'; - echo("
"); - + echo("
"); $sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; $query = mysql_query($sql); unset ($seperator); @@ -27,27 +38,17 @@ if($_GET['optc'] == thumbs) { ".$device['hostname']." - ".$interface['ifDescr']."
\ ".$interface['ifAlias']." \ - \ + \ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". - " + "
".truncate(short_port_descr($interface['ifAlias']), 32, '')."
"); - } echo("
"); } else { -if($_GET['opta'] == graphs ) { - if($_GET['optb']) { - $graph_type = $_GET['optb']; - } else { - $graph_type = "bits"; - } - $dographs = 1; -} - if($_GET['opta'] == "details" ) { $port_details = 1; } diff --git a/html/pages/device/vlans.inc.php b/html/pages/device/vlans.inc.php index 27bc2526f2..787e91dff7 100644 --- a/html/pages/device/vlans.inc.php +++ b/html/pages/device/vlans.inc.php @@ -1,5 +1,14 @@ +Basic | Graphs : +Bits | +Packets | +NU Packets | +Errors + "); + echo("
"); $i = "1"; $vlan_query = mysql_query("select * from vlans WHERE device_id = '".$_GET['id']."' ORDER BY 'vlan_vlan'"); diff --git a/html/pages/device/vrfs.inc.php b/html/pages/device/vrfs.inc.php index 583f27cc1d..d56dfdf63e 100644 --- a/html/pages/device/vrfs.inc.php +++ b/html/pages/device/vrfs.inc.php @@ -1,5 +1,15 @@ +Basic | Graphs : +Bits | +Packets | +NU Packets | +Errors + "); + + echo("
"); $i = "1"; $vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'"); diff --git a/html/pages/ipv4.php b/html/pages/ipv4.php new file mode 100644 index 0000000000..426852f26f --- /dev/null +++ b/html/pages/ipv4.php @@ -0,0 +1,92 @@ +
+ + + + + + + + + +
+ + + + + + + +
+ +"); + +if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; } +if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; } + +$sql = "SELECT * FROM `ipv4_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address"; + +$query = mysql_query($sql); + +echo("DeviceInterfaceAddressSubnetDescription"); + +$row = 1; + +while($interface = mysql_fetch_array($query)) { + + if($_POST['address']) { + list($addy, $mask) = explode("/", $_POST['address']); + if(!$mask) { $mask = "/32"; } + if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; } + } + +if(!$ignore) { + + if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + $speed = humanspeed($interface['ifSpeed']); + $type = humanmedia($interface['ifType']); + + if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) { + $error_img = generateiflink($interface,"Interface Errors",errors); + } else { $error_img = ""; } + + if( interfacepermitted($interface['interface_id']) ) + { + echo(" + " . generatedevicelink($interface) . " + " . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img + " . $interface['ipv4_address'] . " + " . $interface['ipv4_network'] . " + " . $interface['ifAlias'] . " + \n"); + + $row++; + + } + +} + +unset($ignore); + +} + +echo(""); + + +?> diff --git a/html/pages/ipv6.php b/html/pages/ipv6.php new file mode 100644 index 0000000000..c6f87eb037 --- /dev/null +++ b/html/pages/ipv6.php @@ -0,0 +1,92 @@ + + + + + + + + + + +
+ + + + + + + +
+ +"); + +if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; } +if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; } + +$sql = "SELECT * FROM `ipv6_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id $where ORDER BY A.ipv6_address"; + +$query = mysql_query($sql); + +echo("DeviceInterfaceAddressSubnetDescription"); + +$row = 1; + +while($interface = mysql_fetch_array($query)) { + + if($_POST['address']) { + list($addy, $mask) = explode("/", $_POST['address']); + if(!$mask) { $mask = "128"; } + if(!Net_IPv6::isInNetmask ( $interface['ipv6_address'], $addy, $mask )) { $ignore = 1; } else { $ignore = 0;} + } + +if(!$ignore) { + + if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + $speed = humanspeed($interface['ifSpeed']); + $type = humanmedia($interface['ifType']); + + if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) { + $error_img = generateiflink($interface,"Interface Errors",errors); + } else { $error_img = ""; } + + if( interfacepermitted($interface['interface_id']) ) + { + echo(" + " . generatedevicelink($interface) . " + " . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img + " . Net_IPv6::compress($interface['ipv6_address']) . " + " . $interface['ipv6_network'] . " + " . $interface['ifAlias'] . " + \n"); + + $row++; + + } + +} + +unset($ignore); + +} + +echo(""); + + +?> diff --git a/html/pages/vrfs.php b/html/pages/vrfs.php index d2d8f98736..801e44d524 100644 --- a/html/pages/vrfs.php +++ b/html/pages/vrfs.php @@ -1,5 +1,15 @@ +Basic | Graphs : +Bits | +Packets | +NU Packets | +Errors +
"); + + echo("
"); $i = "1"; $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); @@ -29,10 +39,18 @@ echo(""); $x++;
"); $interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); unset($seperator); - while($interface = mysql_fetch_array($interfaces)) { - $interface = array_merge ($device, $interface); - echo($seperator.generateiflink($interface,makeshortif($interface['ifDescr']))); + while($port = mysql_fetch_array($interfaces)) { + + if($_GET['opta']) { + $graph_type = $_GET['opta']; + include("includes/print-port-thumbs.inc.php"); + + } else { + + $port = array_merge ($device, $port); + echo($seperator.generateiflink($port,makeshortif($port['ifDescr']))); $seperator = ", "; + } } echo("