From 1a477eebbe9330449cef7f32b00ac9e7fd56590c Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Wed, 16 Mar 2011 23:10:10 +0000 Subject: [PATCH] device subpages cleanup, remove dead code git-svn-id: http://www.observium.org/svn/observer/trunk@1896 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/device/apps.inc.php | 8 +- html/pages/device/apps/apache.inc.php | 13 +- html/pages/device/apps/mysql.inc.php | 30 +- html/pages/device/apps/nginx.inc.php | 31 +- html/pages/device/arp.inc.php | 21 +- html/pages/device/bgp.inc.php | 15 +- html/pages/device/ciscosensors.inc.php | 57 +-- html/pages/device/collectd.inc.php | 26 +- html/pages/device/edit.inc.php | 62 +-- html/pages/device/edit/device.inc.php | 21 +- html/pages/device/edit/ipmi.inc.php | 9 +- html/pages/device/edit/ports.inc.php | 17 +- html/pages/device/edit/services.inc.php | 67 ++-- html/pages/device/entphysical.inc.php | 137 +++---- html/pages/device/events.inc.php | 6 +- html/pages/device/graphs.inc.php | 23 +- html/pages/device/graphs/cpu.inc.php | 11 +- .../device/graphs/fortigate-sessions.inc.php | 11 +- html/pages/device/graphs/hrprocesses.inc.php | 9 +- html/pages/device/graphs/hrusers.inc.php | 11 +- html/pages/device/graphs/memory.inc.php | 11 +- html/pages/device/graphs/netstats.inc.php | 105 ++--- .../device/graphs/netstats_icmp_info.inc.php | 13 +- .../device/graphs/netstats_icmp_stat.inc.php | 11 +- html/pages/device/graphs/netstats_ip.inc.php | 19 +- .../pages/device/graphs/netstats_snmp.inc.php | 19 +- html/pages/device/graphs/netstats_tcp.inc.php | 13 +- html/pages/device/graphs/netstats_udp.inc.php | 13 +- .../device/graphs/screenos-sessions.inc.php | 12 +- html/pages/device/graphs/screenos.inc.php | 11 +- html/pages/device/graphs/wireless.inc.php | 13 +- html/pages/device/health.inc.php | 28 +- html/pages/device/health/diskio.inc.php | 38 +- html/pages/device/health/mempools.inc.php | 69 ++-- html/pages/device/health/processors.inc.php | 17 +- html/pages/device/health/sensors.inc.php | 11 +- html/pages/device/health/storage.inc.php | 46 ++- html/pages/device/hrdevice.inc.php | 76 ++-- html/pages/device/interface.inc.php | 99 ++--- html/pages/device/nagios.inc.php | 34 -- html/pages/device/overview.inc.php | 35 +- .../device/overview/generic/sensor.inc.php | 9 +- html/pages/device/overview/mempools.inc.php | 26 +- html/pages/device/overview/ports.inc.php | 14 +- html/pages/device/overview/processors.inc.php | 24 +- html/pages/device/overview/storage.inc.php | 52 +-- html/pages/device/port/adsl.inc.php | 50 +-- html/pages/device/port/graphs.inc.php | 48 +-- html/pages/device/port/junose-atm-vp.inc.php | 59 +-- html/pages/device/port/macaccounting.inc.php | 364 +++++++++--------- html/pages/device/port/pagp.inc.php | 52 ++- html/pages/device/ports.inc.php | 47 ++- html/pages/device/showconfig.inc.php | 16 +- html/pages/device/srv.inc.php | 30 +- html/pages/device/syslog.inc.php | 18 +- html/pages/device/vlans.inc.php | 27 +- html/pages/device/vrfs.inc.php | 19 +- 57 files changed, 1072 insertions(+), 1061 deletions(-) delete mode 100644 html/pages/device/nagios.inc.php diff --git a/html/pages/device/apps.inc.php b/html/pages/device/apps.inc.php index a31dede3e..ca4345e76 100644 --- a/html/pages/device/apps.inc.php +++ b/html/pages/device/apps.inc.php @@ -5,10 +5,12 @@ $query = mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$devic print_optionbar_start(); unset($sep); -while($app = mysql_fetch_array($query)) { + +while ($app = mysql_fetch_array($query)) +{ echo($sep); - if(!$_GET['opta']) { $_GET['opta'] = $app['app_type']; } + if (!$_GET['opta']) { $_GET['opta'] = $app['app_type']; } if ($_GET['opta'] == $app['app_type']) { @@ -31,4 +33,4 @@ if (is_file("pages/device/apps/".mres($_GET['opta']).".inc.php")) include("pages/device/apps/".mres($_GET['opta']).".inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/pages/device/apps/apache.inc.php b/html/pages/device/apps/apache.inc.php index 1768708ba..bafdda584 100644 --- a/html/pages/device/apps/apache.inc.php +++ b/html/pages/device/apps/apache.inc.php @@ -1,14 +1,14 @@ 'Traffic - Bytes/sec', 'apache_hits' => 'Traffic - Hits', 'apache_cpu' => 'CPU Utilisation', 'apache_scoreboard' => 'Scoreboard Statistics'); -foreach($graphs as $key => $text) { - +foreach ($graphs as $key => $text) +{ $graph_type = "apache_scoreboard"; $graph_array['height'] = "100"; @@ -21,14 +21,9 @@ foreach($graphs as $key => $text) { echo(""); - include("includes/print-quadgraphs.inc.php"); - echo(""); - - - } -?> +?> \ No newline at end of file diff --git a/html/pages/device/apps/mysql.inc.php b/html/pages/device/apps/mysql.inc.php index 0a05c58aa..28c831f9d 100644 --- a/html/pages/device/apps/mysql.inc.php +++ b/html/pages/device/apps/mysql.inc.php @@ -23,24 +23,20 @@ $graphs = array('mysql_command_counters' => 'Command Counters', 'mysql_table_locks' => 'Table Locks', 'mysql_temporary_objects' => 'Temporary Objects'); -foreach($graphs as $key => $text) { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $now; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); +foreach ($graphs as $key => $text) +{ + $graph_type = $key; + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + echo('

'.$text.'

'); - echo(""); - - - - include("includes/print-quadgraphs.inc.php"); - echo(""); + echo(""); + include("includes/print-quadgraphs.inc.php"); + echo(""); } - - -?> +?> \ No newline at end of file diff --git a/html/pages/device/apps/nginx.inc.php b/html/pages/device/apps/nginx.inc.php index f8edacc58..a26704bf2 100644 --- a/html/pages/device/apps/nginx.inc.php +++ b/html/pages/device/apps/nginx.inc.php @@ -1,27 +1,24 @@ 'nginx Connections', 'nginx_req' => 'nginx requests'); -foreach($graphs as $key => $text) { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $now; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); +foreach ($graphs as $key => $text) +{ + $graph_type = $key; + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + echo('

'.$text.'

'); - echo(""); - - - - include("includes/print-quadgraphs.inc.php"); - echo(""); + echo(""); + include("includes/print-quadgraphs.inc.php"); + echo(""); } - - -?> +?> \ No newline at end of file diff --git a/html/pages/device/arp.inc.php b/html/pages/device/arp.inc.php index 7e5116ea5..1f26584fd 100644 --- a/html/pages/device/arp.inc.php +++ b/html/pages/device/arp.inc.php @@ -1,20 +1,23 @@ -"); +echo(''); + $i = "1"; -while($arp = mysql_fetch_array($query)) { - if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } +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, ports 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 = generate_device_link($arp_host); } else { unset($arp_name); } - if($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } + if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); } + if ($arp_host) { $arp_if = generate_port_link($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"; } + if ($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; } + if ($arp_host['interface_id'] == $arp['interface_id']) { $arp_if = "Local Port"; } echo(" @@ -29,4 +32,4 @@ while($arp = mysql_fetch_array($query)) { echo("
"); -?> +?> \ No newline at end of file diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index 239c68d2f..d0ebbdcbe 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -9,7 +9,7 @@ echo("
No Graphs | Updates"); - + echo(" | Prefixes: IPv4 | VPNv4 | @@ -30,6 +30,7 @@ print_optionbar_end(); -
+ \ No newline at end of file diff --git a/html/pages/device/ciscosensors.inc.php b/html/pages/device/ciscosensors.inc.php index d193b081e..1399814fa 100644 --- a/html/pages/device/ciscosensors.inc.php +++ b/html/pages/device/ciscosensors.inc.php @@ -1,38 +1,39 @@ -"); } - echo("" . htmlspecialchars($type) ."\n"); - if($_GET['opta'] == $type) { echo(""); } - $sep = ' | '; - } - unset ($sep); +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)) +{ + $type = $data['entSensorType']; + if (!$_GET['opta']) { $_GET['opta'] = $type; } + echo($sep); + if ($_GET['opta'] == $type) { echo(""); } + echo("" . htmlspecialchars($type) ."\n"); + if ($_GET['opta'] == $type) { echo(""); } + $sep = ' | '; +} + +unset ($sep); print_optionbar_end(); - $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); - while($data = mysql_fetch_array($query)) { +$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); +while ($data = mysql_fetch_array($query)) +{ + if ($data['entSensorMeasuredEntity']) + { + $measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'")); + } - if($data['entSensorMeasuredEntity']) { - $measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'")); - } + echo("

".$measured['entPhysicalName']." ".$data['entPhysicalName']."

"); + $graph_type = "cisco_entity_sensor"; + $args = "&a=".$data['entPhysical_id']; - echo("

".$measured['entPhysicalName']." ".$data['entPhysicalName']."

"); - $graph_type = "cisco_entity_sensor"; - $args = "&a=".$data['entPhysical_id']; + include("includes/print-device-graph.php"); - include("includes/print-device-graph.php"); + echo("
"); +} - echo("
"); - - - } - -?> +?> \ No newline at end of file diff --git a/html/pages/device/collectd.inc.php b/html/pages/device/collectd.inc.php index c3ef0b861..715d92278 100644 --- a/html/pages/device/collectd.inc.php +++ b/html/pages/device/collectd.inc.php @@ -50,11 +50,11 @@ print_optionbar_start(); $plugins = collectd_list_plugins($device['hostname']); foreach ($plugins as &$plugin) { - if(!$_GET['opta']) { $_GET['opta'] = $plugin; } + if (!$_GET['opta']) { $_GET['opta'] = $plugin; } echo($sep); - if($_GET['opta'] == $plugin) { echo(""); } + if ($_GET['opta'] == $plugin) { echo(""); } echo("" . htmlspecialchars($plugin) ."\n"); - if($_GET['opta'] == $plugin) { echo(""); } + if ($_GET['opta'] == $plugin) { echo(""); } $sep = ' | '; } unset ($sep); @@ -70,18 +70,18 @@ print_optionbar_end(); foreach ($types as &$type) { $typeinstances = collectd_list_tinsts($device['hostname'], $_GET['opta'], $instance, $type); - - if($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); } - + if ($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); } + + foreach ($typeinstances as &$tinst) { $i++; - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + echo('
'); echo('
'); - if($tinst) { + if ($tinst) { echo($_GET['opta']." $instance - $type - $tinst"); } else { echo($_GET['opta']." $instance - $type"); @@ -96,7 +96,7 @@ print_optionbar_end(); $weekly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$week&to=$now&width=215&height=100"; $weekly_traffic .= $args; $weekly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$week&to=$now&width=400&height=150"; - $weekly_url .= $args; + $weekly_url .= $args; $monthly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$month&to=$now&width=215&height=100"; $monthly_traffic .= $args; @@ -107,7 +107,7 @@ print_optionbar_end(); $yearly_traffic .= $args; $yearly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$year&to=$now&width=400&height=150"; $yearly_url .= $args; - + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); @@ -117,9 +117,9 @@ print_optionbar_end(); "); echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - + echo("
"); - + } } diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index ad4a818db..3f8702f9c 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -1,42 +1,42 @@ 'Device Settings', + 'ports' => 'Port Settings', + 'apps' => 'Applications', + 'services' => 'Services', + 'ipmi' => 'IPMI'); -$panes = array('device' => 'Device Settings', - 'ports' => 'Port Settings', - 'apps' => 'Applications', - 'services' => 'Services', - 'ipmi' => 'IPMI'); + print_optionbar_start(); -print_optionbar_start(); - -unset($sep); -foreach($panes as $type => $text) { - - if(!isset($_GET['opta'])) { $_GET['opta'] = $type; } - echo($sep); - if ($_GET['opta'] == $type) + unset($sep); + foreach ($panes as $type => $text) { - echo(""); - echo(''); - } else { - echo(''); + if (!isset($_GET['opta'])) { $_GET['opta'] = $type; } + echo($sep); + if ($_GET['opta'] == $type) + { + echo(""); + echo(''); + } else { + echo(''); + } + + echo(" " . $text ."\n"); + if ($_GET['opta'] == $type) { echo(""); } + $sep = " | "; + } + + print_optionbar_end(); + + if (is_file("pages/device/edit/".mres($_GET['opta']).".inc.php")) + { + include("pages/device/edit/".mres($_GET['opta']).".inc.php"); } - echo(" " . $text ."\n"); - if ($_GET['opta'] == $type) { echo(""); } - $sep = " | "; -} - -print_optionbar_end(); - -if (is_file("pages/device/edit/".mres($_GET['opta']).".inc.php")) -{ - include("pages/device/edit/".mres($_GET['opta']).".inc.php"); -} else { -} - } +?> \ No newline at end of file diff --git a/html/pages/device/edit/device.inc.php b/html/pages/device/edit/device.inc.php index 86b7ede3e..9b881922b 100644 --- a/html/pages/device/edit/device.inc.php +++ b/html/pages/device/edit/device.inc.php @@ -1,7 +1,9 @@ "7") { +if ($_POST['editing']) +{ + if ($_SESSION['userlevel'] > "7") + { include("includes/device-edit.inc.php"); } } @@ -9,7 +11,8 @@ if($_POST['editing']) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); $descr = $device['purpose']; -if($updated && $update_message) { +if ($updated && $update_message) +{ print_message($update_message); } elseif ($update_message) { print_error($update_message); @@ -53,11 +56,14 @@ echo(" @@ -102,11 +108,11 @@ echo(" "); @@ -120,5 +126,4 @@ echo('
SNMP Transport
Disable
Ignore
'); - -?> +?> \ No newline at end of file diff --git a/html/pages/device/edit/ipmi.inc.php b/html/pages/device/edit/ipmi.inc.php index 1ce0a49fb..0488671d1 100644 --- a/html/pages/device/edit/ipmi.inc.php +++ b/html/pages/device/edit/ipmi.inc.php @@ -1,7 +1,9 @@ "7") { +if ($_POST['editing']) +{ + if ($_SESSION['userlevel'] > "7") + { include("includes/device-ipmi-edit.inc.php"); } } @@ -9,7 +11,8 @@ if($_POST['editing']) { $device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); $descr = $device['purpose']; -if($updated && $update_message) { +if ($updated && $update_message) +{ print_message($update_message); } elseif ($update_message) { print_error($update_message); diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php index aebfe6da4..3c5823ee5 100644 --- a/html/pages/device/edit/ports.inc.php +++ b/html/pages/device/edit/ports.inc.php @@ -2,14 +2,16 @@ echo('
'); -if($_POST['ignoreport']) { - if($_SESSION['userlevel'] == '10') { +if ($_POST['ignoreport']) +{ + if ($_SESSION['userlevel'] == '10') + { include("includes/port-edit.inc.php"); } } - -if($updated && $update_message) { +if ($updated && $update_message) +{ print_message($update_message); } elseif ($update_message) { print_error($update_message); @@ -23,13 +25,14 @@ echo("
PortifDescrifAdminStatusifOperStatusIgnore"); $query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` "); -while($device = mysql_fetch_array($query)) { +while ($device = mysql_fetch_array($query)) +{ echo(""); echo("". $device['ifIndex'].""); echo("".$device['ifDescr'] . ""); echo("". $device['ifAdminStatus'].""); - # Mark interfaces which are OperDown (but not AdminDown) yet not ignored, or up - yet ignored - as to draw the attention + # Mark interfaces which are OperDown (but not AdminDown) yet not ignored, or up - yet ignored - as to draw the attention # to a possible problem. # $outofsync = ($device['ignore'] == ($device['ifOperStatus'] == 'down' && $device['ifAdminStatus'] != 'down' ? 1 : 0)) ? "" : "class=red"; @@ -48,4 +51,4 @@ echo(''); echo(''); echo('
'); -?> +?> \ No newline at end of file diff --git a/html/pages/device/edit/services.inc.php b/html/pages/device/edit/services.inc.php index 4c07c487e..9d66fdafc 100644 --- a/html/pages/device/edit/services.inc.php +++ b/html/pages/device/edit/services.inc.php @@ -2,49 +2,53 @@ echo('
'); -if($_POST['addsrv']) { - if($_SESSION['userlevel'] == '10') { +if ($_POST['addsrv']) { + if ($_SESSION['userlevel'] == '10') { include("includes/service-add.inc.php"); } } -if($_POST['delsrv']) { - if($_SESSION['userlevel'] == '10') { +if ($_POST['delsrv']) { + if ($_SESSION['userlevel'] == '10') { include("includes/service-delete.inc.php"); } } - -if ($handle = opendir($config['install_dir'] . "/includes/services/")) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != ".." && !strstr($file, ".")) { - $servicesform .= ""; - } +if ($handle = opendir($config['install_dir'] . "/includes/services/")) +{ + while (false !== ($file = readdir($handle))) + { + if ($file != "." && $file != ".." && !strstr($file, ".")) + { + $servicesform .= ""; } - closedir($handle); + } + + closedir($handle); } $query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); -while($device = mysql_fetch_array($query)) { +while ($device = mysql_fetch_array($query)) +{ $devicesform .= ""; } -if($updated) { print_message("Device Settings Saved"); } - - -if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') { - $i = "1"; - $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); - while($service = mysql_fetch_array($service_query)) { - $existform .= ""; - - } +if ($updated) { print_message("Device Settings Saved"); } +if (mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') +{ + $i = "1"; + $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); + while ($service = mysql_fetch_array($service_query)) + { + $existform .= ""; + } } -if($existform){ -echo('
'); -echo(" +if($existform +{ + echo('
'); + echo("

Remove Service

@@ -64,12 +68,10 @@ echo(" - "); - -echo('
'); + echo('
'); } echo('
'); @@ -95,10 +97,7 @@ echo(" -"); + +
"); -echo('
'); - -echo('
'); - -?> +?> \ No newline at end of file diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index c2d709423..ec1f4aafe 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -1,77 +1,84 @@ "); - $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); - while($ent = mysql_fetch_array($query)) { - echo(" -
  • "); + if ($ent['entPhysicalClass'] == "chassis") { echo(" "); } + if ($ent['entPhysicalClass'] == "module") { echo(" "); } + if ($ent['entPhysicalClass'] == "port") { echo(" "); } + if ($ent['entPhysicalClass'] == "container") { echo(" "); } + if ($ent['entPhysicalClass'] == "sensor") + { + echo(" "); + $link = " href='".$config['base_url'] . "/device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; + } else { unset ($link); } - if($ent['entPhysicalClass'] == "chassis") { echo(" "); } - if($ent['entPhysicalClass'] == "module") { echo(" "); } - if($ent['entPhysicalClass'] == "port") { echo(" "); } - if($ent['entPhysicalClass'] == "container") { echo(" "); } - if($ent['entPhysicalClass'] == "sensor") { - echo(" "); - $link = " href='".$config['base_url'] . "/device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; - } else { unset ($link); } - if($ent['entPhysicalClass'] == "backplane") { echo(" "); } - if($ent['entPhysicalParentRelPos'] > '-1') {echo("".$ent['entPhysicalParentRelPos'].". ");} + if ($ent['entPhysicalClass'] == "backplane") { echo(" "); } + if ($ent['entPhysicalParentRelPos'] > '-1') {echo("".$ent['entPhysicalParentRelPos'].". "); } - if($link) {echo("");} + if ($link) {echo(""); } - if($ent['ifIndex']) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); - $ent['entPhysicalName'] = generate_port_link($interface); - } - - if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) { - echo("".$ent['entPhysicalModelName'] . " (".$ent['entPhysicalName'].")"); - } elseif($ent['entPhysicalModelName']) { - echo("".$ent['entPhysicalModelName'] . ""); - } elseif($ent['entPhysicalName']) { - echo("".$ent['entPhysicalName'].""); - } elseif($ent['entPhysicalDescr']) { - echo("".$ent['entPhysicalDescr'].""); - } - - if($ent['entPhysicalClass'] == "sensor") { - echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")"); - } - - echo("
    " . $ent['entPhysicalDescr']); - - if($link) {echo("");} - - if($ent['entPhysicalSerialNum']) { - echo("
    Serial No. ".$ent['entPhysicalSerialNum']." "); - } - - echo("
    "); - - $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); - if($count) { - echo("
      "); - printEntPhysical($ent['entPhysicalIndex'], $level+1, ''); - echo("
    "); - } - echo("
  • "); + if ($ent['ifIndex']) + { + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); + $ent['entPhysicalName'] = generate_port_link($interface); } + + if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) + { + echo("".$ent['entPhysicalModelName'] . " (".$ent['entPhysicalName'].")"); + } elseif ($ent['entPhysicalModelName']) { + echo("".$ent['entPhysicalModelName'] . ""); + } elseif ($ent['entPhysicalName']) { + echo("".$ent['entPhysicalName'].""); + } elseif ($ent['entPhysicalDescr']) { + echo("".$ent['entPhysicalDescr'].""); + } + + if ($ent['entPhysicalClass'] == "sensor") + { + echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")"); + } + + echo("
    " . $ent['entPhysicalDescr']); + + if ($link) { echo(""); } + + if ($ent['entPhysicalSerialNum']) + { + echo("
    Serial No. ".$ent['entPhysicalSerialNum']." "); + } + + echo("
    "); + + $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); + if ($count) + { + echo(""); + } + + echo(""); + } } - echo("
    - Expand All Nodes - Collapse All Nodes -
    "); +echo("
    + Expand All Nodes + Collapse All Nodes +
    "); - echo("
      "); - $level = "0"; - $ent['entPhysicalIndex'] = "0"; - printEntPhysical($ent['entPhysicalIndex'], $level, "liOpen"); - echo("
    "); - - -?> +echo("
      "); +$level = "0"; +$ent['entPhysicalIndex'] = "0"; +printEntPhysical($ent['entPhysicalIndex'], $level, "liOpen"); +echo("
    "); +?> \ No newline at end of file diff --git a/html/pages/device/events.inc.php b/html/pages/device/events.inc.php index b77be64fa..e40b10181 100644 --- a/html/pages/device/events.inc.php +++ b/html/pages/device/events.inc.php @@ -4,9 +4,11 @@ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `even $data = mysql_query($query); echo(''); -while($entry = mysql_fetch_array($data)) { +while ($entry = mysql_fetch_array($data)) +{ include("includes/print-event.inc"); } + echo('
    '); -?> +?> \ No newline at end of file diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php index 756c07cf2..f4907cf19 100644 --- a/html/pages/device/graphs.inc.php +++ b/html/pages/device/graphs.inc.php @@ -11,18 +11,19 @@ print_optionbar_start('', ''); $sep = ""; $query = mysql_query("SELECT * FROM device_graphs WHERE device_id = '".$device['device_id']."'"); -while($graph = mysql_fetch_assoc($query)) + +while ($graph = mysql_fetch_assoc($query)) { $section = $config['graph_types']['device'][$graph['graph']]['section']; $graph_enable[$section][$graph['graph']] = $graph['graph']; } -foreach($config['graph_sections'] as $section) +foreach ($config['graph_sections'] as $section) { - if(isset($graph_enable) && is_array($graph_enable[$section])) + if (isset($graph_enable) && is_array($graph_enable[$section])) { $type = strtolower($section); - if(!$_GET['opta']) { $_GET['opta'] = $type; } + if (!$_GET['opta']) { $_GET['opta'] = $type; } echo($sep); if ($_GET['opta'] == $type) { @@ -33,24 +34,21 @@ foreach($config['graph_sections'] as $section) { echo(''); } + echo(" " . $type ."\n"); if ($_GET['opta'] == $type) { echo(""); } $sep = " | "; } } + unset ($sep); print_optionbar_end(); -#echo("
    ");
    -#print_r($_GET['opta']);
    -#print_r($graph_enable);
    -#echo("
    "); - $graph_enable = $graph_enable[$_GET['opta']]; -foreach($config['graph_types']['device'] as $graph => $entry) +foreach ($config['graph_types']['device'] as $graph => $entry) { - if($graph_enable[$graph]) + if ($graph_enable[$graph]) { $graph_title = $config['graph_types']['device'][$graph]['descr']; $graph_type = "device_" . $graph; @@ -58,5 +56,4 @@ foreach($config['graph_types']['device'] as $graph => $entry) } } -?> - +?> \ No newline at end of file diff --git a/html/pages/device/graphs/cpu.inc.php b/html/pages/device/graphs/cpu.inc.php index 84597a097..cf011b3f2 100644 --- a/html/pages/device/graphs/cpu.inc.php +++ b/html/pages/device/graphs/cpu.inc.php @@ -1,7 +1,10 @@ diff --git a/html/pages/device/graphs/fortigate-sessions.inc.php b/html/pages/device/graphs/fortigate-sessions.inc.php index 8c22b9d09..f1494f7ac 100644 --- a/html/pages/device/graphs/fortigate-sessions.inc.php +++ b/html/pages/device/graphs/fortigate-sessions.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/hrprocesses.inc.php b/html/pages/device/graphs/hrprocesses.inc.php index 0a03a49fb..452d0dacb 100644 --- a/html/pages/device/graphs/hrprocesses.inc.php +++ b/html/pages/device/graphs/hrprocesses.inc.php @@ -1,7 +1,10 @@ + +?> \ No newline at end of file diff --git a/html/pages/device/graphs/hrusers.inc.php b/html/pages/device/graphs/hrusers.inc.php index 1829c5a60..20f9fb84f 100644 --- a/html/pages/device/graphs/hrusers.inc.php +++ b/html/pages/device/graphs/hrusers.inc.php @@ -1,11 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/memory.inc.php b/html/pages/device/graphs/memory.inc.php index 211f9ca25..664fc762a 100644 --- a/html/pages/device/graphs/memory.inc.php +++ b/html/pages/device/graphs/memory.inc.php @@ -1,7 +1,10 @@ + +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats.inc.php b/html/pages/device/graphs/netstats.inc.php index e2845e340..62d2afe1c 100644 --- a/html/pages/device/graphs/netstats.inc.php +++ b/html/pages/device/graphs/netstats.inc.php @@ -1,63 +1,68 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_icmp_info.inc.php b/html/pages/device/graphs/netstats_icmp_info.inc.php index 118e2658e..f3a120351 100644 --- a/html/pages/device/graphs/netstats_icmp_info.inc.php +++ b/html/pages/device/graphs/netstats_icmp_info.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_icmp_stat.inc.php b/html/pages/device/graphs/netstats_icmp_stat.inc.php index 78417e939..e335013d8 100644 --- a/html/pages/device/graphs/netstats_icmp_stat.inc.php +++ b/html/pages/device/graphs/netstats_icmp_stat.inc.php @@ -1,9 +1,10 @@ diff --git a/html/pages/device/graphs/netstats_ip.inc.php b/html/pages/device/graphs/netstats_ip.inc.php index 5cba1a4ab..cba3e700d 100644 --- a/html/pages/device/graphs/netstats_ip.inc.php +++ b/html/pages/device/graphs/netstats_ip.inc.php @@ -1,13 +1,14 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_snmp.inc.php b/html/pages/device/graphs/netstats_snmp.inc.php index 473b9b12a..00fa9a6f6 100644 --- a/html/pages/device/graphs/netstats_snmp.inc.php +++ b/html/pages/device/graphs/netstats_snmp.inc.php @@ -1,13 +1,14 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_tcp.inc.php b/html/pages/device/graphs/netstats_tcp.inc.php index 423942d06..3bd30c74b 100644 --- a/html/pages/device/graphs/netstats_tcp.inc.php +++ b/html/pages/device/graphs/netstats_tcp.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_udp.inc.php b/html/pages/device/graphs/netstats_udp.inc.php index 795c9df59..0cadd35ad 100644 --- a/html/pages/device/graphs/netstats_udp.inc.php +++ b/html/pages/device/graphs/netstats_udp.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/screenos-sessions.inc.php b/html/pages/device/graphs/screenos-sessions.inc.php index efab46db8..49dd4ac32 100644 --- a/html/pages/device/graphs/screenos-sessions.inc.php +++ b/html/pages/device/graphs/screenos-sessions.inc.php @@ -1,10 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/screenos.inc.php b/html/pages/device/graphs/screenos.inc.php index 9f6e5187c..9bdb4d5b1 100644 --- a/html/pages/device/graphs/screenos.inc.php +++ b/html/pages/device/graphs/screenos.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/graphs/wireless.inc.php b/html/pages/device/graphs/wireless.inc.php index 1bc0ea2d5..75321dcd1 100644 --- a/html/pages/device/graphs/wireless.inc.php +++ b/html/pages/device/graphs/wireless.inc.php @@ -1,9 +1,10 @@ +?> \ No newline at end of file diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php index a9e367753..adae5fce9 100644 --- a/html/pages/device/health.inc.php +++ b/html/pages/device/health.inc.php @@ -24,7 +24,6 @@ if ($volts) { $datas[] = 'voltages'; } if ($freqs) { $datas[] = 'frequencies'; } if ($current) { $datas[] = 'current'; } - $type_text['overview'] = "Overview"; $type_text['temperatures'] = "Temperatures"; $type_text['humidity'] = "Humidity"; @@ -39,14 +38,14 @@ $type_text['current'] = "Current"; print_optionbar_start(); -if(!$_GET['opta']) { $_GET['opta'] = "overview"; } +if (!$_GET['opta']) { $_GET['opta'] = "overview"; } unset($sep); -foreach ($datas as $type) { - +foreach ($datas as $type) +{ echo($sep); - if ($_GET['opta'] == $type) + if ($_GET['opta'] == $type) { echo(""); echo(''); @@ -60,18 +59,19 @@ foreach ($datas as $type) { print_optionbar_end(); -if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) -{ - include("pages/device/health/".mres($_GET['opta']).".inc.php"); -} else { - foreach ($datas as $type) { - if($type != "overview") { +if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) +{ + include("pages/device/health/".mres($_GET['opta']).".inc.php"); +} else { + foreach ($datas as $type) + { + if ($type != "overview") + { $graph_title = $type_text[$type]; $graph_type = "device_".$type; - include ("includes/print-device-graph.php"); + include ("includes/print-device-graph.php"); } } } - -?> +?> \ No newline at end of file diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php index 4201929e5..3f3b70b6b 100644 --- a/html/pages/device/health/diskio.inc.php +++ b/html/pages/device/health/diskio.inc.php @@ -3,7 +3,7 @@ $sql = "SELECT * FROM `ucd_diskio` WHERE device_id = '" . mres($_GET['id']) . "' ORDER BY diskio_descr"; $query = mysql_query($sql); -echo(""); +echo('
    '); #echo(" # @@ -14,28 +14,28 @@ echo("
    Drive
    "); $row = 1; -while($drive = mysql_fetch_array($query)) { +while ($drive = mysql_fetch_array($query)) +{ + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + $fs_url = "device/".$device['device_id']."/health/diskio/"; - $fs_url = "device/".$device['device_id']."/health/diskio/"; + $fs_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$drive['diskio_descr']; + $fs_popup .= "
    "; + $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; - $fs_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$drive['diskio_descr']; - $fs_popup .= "
    "; - $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } - - echo(""); + echo(""); $types = array("diskio_bits", "diskio_ops"); - foreach($types as $graph_type) { - + foreach ($types as $graph_type) + { echo('"); - } $row++; - } - echo("
    " . $drive['diskio_descr'] . "
    " . $drive['diskio_descr'] . "
    '); $graph_array['id'] = $drive['diskio_id']; @@ -44,13 +44,11 @@ while($drive = mysql_fetch_array($query)) { include("includes/print-quadgraphs.inc.php"); echo("
    "); +echo(""); -?> +?> \ No newline at end of file diff --git a/html/pages/device/health/mempools.inc.php b/html/pages/device/health/mempools.inc.php index 7bb58e79b..a90695d53 100644 --- a/html/pages/device/health/mempools.inc.php +++ b/html/pages/device/health/mempools.inc.php @@ -1,36 +1,39 @@ "); - echo(""); - $i = '1'; - $mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); - while($mempool = mysql_fetch_array($mempools)) { - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - - $text_descr = rewrite_entity_descr($mempool['mempool_descr']); - $mempool_url = "device/".$device['device_id']."/health/memory/"; - $mini_url = "graph.php?id=".$mempool['mempool_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; +echo("
    "); +echo("
    "); - $mempool_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$text_descr; - $mempool_popup .= "
    "; - $mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; +$i = '1'; +$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); - $total = formatStorage($mempool['mempool_total']); - $used = formatStorage($mempool['mempool_used']); - $free = formatStorage($mempool['mempool_free']); +while ($mempool = mysql_fetch_array($mempools)) +{ + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); + $text_descr = rewrite_entity_descr($mempool['mempool_descr']); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + $mempool_url = "device/".$device['device_id']."/health/memory/"; + $mini_url = "graph.php?id=".$mempool['mempool_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - echo(" + $mempool_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$text_descr; + $mempool_popup .= "
    "; + $mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; + + $total = formatStorage($mempool['mempool_total']); + $used = formatStorage($mempool['mempool_used']); + $free = formatStorage($mempool['mempool_free']); + + $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); + + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } + + echo(""); - echo(""); - - $i++; - } - echo("
    " . $text_descr . "
    " . $text_descr . " ".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $free , "ffffff", $right_background)." @@ -38,23 +41,19 @@ $graph_type = "mempool_usage"; ".$perc."%
    "); - $graph_array['id'] = $mempool['mempool_id']; $graph_array['type'] = $graph_type; include("includes/print-quadgraphs.inc.php"); - echo("
    "); - echo("
    "); - - -?> + $i++; +} + +echo(""); +echo(""); + +?> \ No newline at end of file diff --git a/html/pages/device/health/processors.inc.php b/html/pages/device/health/processors.inc.php index fa8f51978..223688f71 100644 --- a/html/pages/device/health/processors.inc.php +++ b/html/pages/device/health/processors.inc.php @@ -4,10 +4,11 @@ $graph_type = "processor_usage"; echo("
    "); echo(""); + $i = '1'; $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); -while($proc = mysql_fetch_array($procs)) { - +while ($proc = mysql_fetch_array($procs)) +{ $proc_url = "device/".$device['device_id']."/health/processors/"; $mini_url = "graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; @@ -22,10 +23,10 @@ while($proc = mysql_fetch_array($procs)) { $perc = round($proc['processor_usage']); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; + } elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; + } elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; + } elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo(" @@ -42,11 +43,9 @@ while($proc = mysql_fetch_array($procs)) { $graph_array['type'] = $graph_type; include("includes/print-quadgraphs.inc.php"); - } echo("
    "); echo("
    "); - -?> +?> \ No newline at end of file diff --git a/html/pages/device/health/sensors.inc.php b/html/pages/device/health/sensors.inc.php index b8ef28453..b9e12e19a 100644 --- a/html/pages/device/health/sensors.inc.php +++ b/html/pages/device/health/sensors.inc.php @@ -7,9 +7,9 @@ echo(""); $row = 1; -while($temp = mysql_fetch_array($query)) { - - if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } +while ($temp = mysql_fetch_array($query)) +{ + if (!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } echo(" @@ -27,12 +27,9 @@ while($temp = mysql_fetch_array($query)) { echo(""); - $row++; - } echo("
    " . $temp['sensor_descr'] . "
    "); - -?> +?> \ No newline at end of file diff --git a/html/pages/device/health/storage.inc.php b/html/pages/device/health/storage.inc.php index 9bf06b49a..b532d67ee 100644 --- a/html/pages/device/health/storage.inc.php +++ b/html/pages/device/health/storage.inc.php @@ -16,31 +16,31 @@ echo(" $row = 1; -while($drive = mysql_fetch_array($query)) { +while ($drive = mysql_fetch_array($query)) +{ + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + $total = $drive['storage_size']; + $used = $drive['storage_used']; + $free = $drive['storage_free']; + $perc = round($drive['storage_perc'], 0); + $used = formatStorage($used); + $total = formatStorage($total); + $free = formatStorage($free); - $total = $drive['storage_size']; - $used = $drive['storage_used']; - $free = $drive['storage_free']; - $perc = round($drive['storage_perc'], 0); - $used = formatStorage($used); - $total = formatStorage($total); - $free = formatStorage($free); + $fs_url = "device/".$device['device_id']."/health/storage/"; - $fs_url = "device/".$device['device_id']."/health/storage/"; + $fs_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$drive['storage_descr']; + $fs_popup .= "
    "; + $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; - $fs_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$drive['storage_descr']; - $fs_popup .= "
    "; - $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } - - echo("" . $drive['storage_descr'] . " + echo("" . $drive['storage_descr'] . " ".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)." " . $free . ""); @@ -53,11 +53,9 @@ while($drive = mysql_fetch_array($query)) { echo(""); - $row++; - } - echo(""); +echo(""); -?> +?> \ No newline at end of file diff --git a/html/pages/device/hrdevice.inc.php b/html/pages/device/hrdevice.inc.php index a7b44187f..6c4043df2 100644 --- a/html/pages/device/hrdevice.inc.php +++ b/html/pages/device/hrdevice.inc.php @@ -3,55 +3,56 @@ echo(""); $hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`"); -while($hrdevice = mysql_fetch_array($hrdevices)) { +while ($hrdevice = mysql_fetch_array($hrdevices)) +{ echo(""); -if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") { - $proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'"),0); - $proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/"; - $proc_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$hrdevice['hrDeviceDescr']; - $proc_popup .= "
    "; - $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - echo(""); + if ($hrdevice['hrDeviceType'] == "hrDeviceProcessor") + { + $proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'"),0); + $proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/"; + $proc_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$hrdevice['hrDeviceDescr']; + $proc_popup .= "
    "; + $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; + echo(""); - $graph_array['height'] = "20"; - $graph_array['width'] = "100"; - $graph_array['to'] = $now; - $graph_array['id'] = $proc_id; - $graph_array['type'] = 'processor_usage'; - $graph_array['from'] = $day; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + $graph_array['height'] = "20"; + $graph_array['width'] = "100"; + $graph_array['to'] = $now; + $graph_array['id'] = $proc_id; + $graph_array['type'] = 'processor_usage'; + $graph_array['from'] = $day; + $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - $mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); + $mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); + echo(''); + } elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") { + $int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'")); + if ($interface['ifIndex']) { + echo(""); - echo(''); -} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") { - $int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']); - $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'")); - if($interface['ifIndex']) { - echo(""); + $graph_array['height'] = "20"; + $graph_array['width'] = "100"; + $graph_array['to'] = $now; + $graph_array['id'] = $interface['interface_id']; + $graph_array['type'] = 'port_bits'; + $graph_array['from'] = $day; + $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - $graph_array['height'] = "20"; - $graph_array['width'] = "100"; - $graph_array['to'] = $now; - $graph_array['id'] = $interface['interface_id']; - $graph_array['type'] = 'port_bits'; - $graph_array['from'] = $day; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + $mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); - $mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); - - echo(""); + echo(""); + } else { + echo(""); + echo(""); + } } else { echo(""); echo(""); } -} else { - echo(""); - echo(""); -} echo(""); echo(""); @@ -61,5 +62,4 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") { echo("
    ".$hrdevice['hrDeviceIndex']."".$hrdevice['hrDeviceDescr']."".$hrdevice['hrDeviceDescr']."'.$mini_graph.'".generate_port_link($interface)."'.$mini_graph.'".generate_port_link($interface)."$mini_graph$mini_graph".$hrdevice['hrDeviceDescr']."".$hrdevice['hrDeviceDescr']."".$hrdevice['hrDeviceDescr']."".$hrdevice['hrDeviceType']."".$hrdevice['hrDeviceStatus']."".$hrdevice['hrDeviceErrors']."".$hrdevice['hrProcessorLoad']."
    "); -?> - +?> \ No newline at end of file diff --git a/html/pages/device/interface.inc.php b/html/pages/device/interface.inc.php index 5f26cf427..6eddbf9ec 100644 --- a/html/pages/device/interface.inc.php +++ b/html/pages/device/interface.inc.php @@ -1,52 +1,57 @@ Disabled"; } - if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } - if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } +$color = "black"; +if ($interface['ifAdminStatus'] == "down") { $status = "Disabled"; } +if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } +if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } - $i = 1; - $inf = fixifName($ifname); +$i = 1; +$inf = fixifName($ifname); - $bg="#ffffff"; +$bg="#ffffff"; - $show_all = 1; +$show_all = 1; - echo("
    "); +echo("
    "); - include("includes/print-interface.inc.php"); +include("includes/print-interface.inc.php"); - echo("
    "); +echo(""); - $pos = strpos(strtolower($ifname), "vlan"); - if( $pos !== false ) { +$pos = strpos(strtolower($ifname), "vlan"); +if ($pos !== false ) +{ $broke = yes; - } - $pos = strpos(strtolower($ifname), "loopback"); - if( $pos !== false ) { - $broke = yes; - } +} - if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) { +$pos = strpos(strtolower($ifname), "loopback"); + +if ($pos !== false ) +{ + $broke = yes; +} + +if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) +{ $pagp = " | PAgP"; - } +} echo("
    "); @@ -54,37 +59,35 @@ print_optionbar_start(); echo("Graphs | "); -if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0)) +if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0)) { echo("ADSL | "); } echo("ARP Table$pagp"); - - - if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0) > "0"){ - echo(" | Mac Accounting : - Bits - (Mini|Top10) | +if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0) > "0") +{ + echo(" | Mac Accounting : + Bits + (Mini|Top10) | Packets (Mini)"); - } - - - if(mysql_result(mysql_query("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"),0) > "0"){ - echo(" | ATM VPs :"); - echo(" Bits"); - echo(" | Packets"); - echo(" | Cells"); - echo(" | Errors"); - - } +} +if (mysql_result(mysql_query("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"),0) > "0") +{ + echo(" | ATM VPs :"); + echo(" Bits"); + echo(" | Packets"); + echo(" | Cells"); + echo(" | Errors"); +} print_optionbar_end(); echo("
    "); include("pages/device/port/".mres($_GET['optb']).".inc.php"); echo("
    "); -?> + +?> \ No newline at end of file diff --git a/html/pages/device/nagios.inc.php b/html/pages/device/nagios.inc.php deleted file mode 100644 index 47f54f793..000000000 --- a/html/pages/device/nagios.inc.php +++ /dev/null @@ -1,34 +0,0 @@ - 'Up', '1' => 'Down', '2' => 'Critical', '3' => 'Unknown'); -$host_text = array ('0' => 'Up', '1' => 'Down', '2' => 'Unreachable'); - -$host_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666'); -$service_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666', '3' => '#ffaa99'); - - -echo("
    Status : " . $host_text[$nagios_hoststatus[current_state]] . " ".$nagios_hoststatus['output']."
    "); - - -echo(""); -$nagios_services = mysql_query("SELECT * FROM nagios_services AS N, nagios_servicestatus AS S WHERE N.host_object_id = '".$nagios_host['host_object_id']."' AND S.service_object_id = N.service_object_id", $nagios_link); -while ($nagios_service = mysql_fetch_array($nagios_services)) { - if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - echo(""); - $service_state = $nagios_service['current_state']; - echo(""); - echo(""); - $i++; -} - -echo("
    " . $nagios_service['display_name'] . "".$service_text[$service_state]."" . $nagios_service['output'] . "
    "); - - -?> diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index 614ab80d8..d3a5d44e7 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -2,10 +2,6 @@ $overview = 1; -#$id = $_GET['id']; - -#$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'")); - $ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0); $ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0); $ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); @@ -16,12 +12,12 @@ $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM servic $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_status = '0' AND service_ignore = '0'"),0); $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_ignore = '1'"),0); -if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; } -if($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; } +if ($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; } +if ($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; } echo("
    "); -#if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) { +#if (file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) { echo("
    "); # echo("

    Device Data

    "); # include("includes/dev-data-" . strtolower($device[os]) . ".inc.php"); @@ -29,15 +25,14 @@ echo("
    "); echo("
    "); #} - include("overview/ports.inc.php"); -if($services['total']) { - +if ($services['total']) +{ echo("
    "); echo("

    Services

    "); -echo(" + echo(" @@ -50,7 +45,8 @@ echo(" $sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type"; $query = mysql_query($sql); - while($data = mysql_fetch_array($query)) { + while ($data = mysql_fetch_array($query)) + { if ($data[service_status] == "0" && $data[service_ignore] == "1") { $status = "grey"; } if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; } if ($data[service_status] == "0" && $data[service_ignore] == "0") { $status = "red"; } @@ -60,20 +56,19 @@ echo(" } echo(""); - echo(""); - } $sql = "SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = '" . $_GET['id'] . "' $where"; $sql .= " ORDER BY timestamp DESC LIMIT 20"; $query = mysql_query($sql); -if(mysql_affected_rows() > "0"){ +if (mysql_affected_rows() > "0") +{ echo("
    "); echo("

    Recent Syslog

    "); echo("
    $services[total]
    "); - while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } + while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } echo("
    "); echo("
    "); } @@ -82,7 +77,6 @@ echo("
    "); echo("
    "); - ### Right Pane include("overview/processors.inc.php"); include("overview/mempools.inc.php"); @@ -105,11 +99,12 @@ $data = mysql_query($query); echo(""); -while($entry = mysql_fetch_array($data)) { +while ($entry = mysql_fetch_array($data)) +{ include("includes/print-event-short.inc"); } echo("
    "); - echo("
    "); -?> + +?> \ No newline at end of file diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index aa91c7bb4..8e20e6e73 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -2,16 +2,16 @@ $results = mysql_query("SELECT * FROM sensors WHERE sensor_class='" . $sensor_class . "' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); -if(mysql_num_rows($results)) +if (mysql_num_rows($results)) { $rows = round(mysql_num_rows($results) / 2,0); echo('
    '); echo('

    ' . $sensor_type . '

    '); $i = '1'; echo(''); - while($sensor = mysql_fetch_array($results)) + while ($sensor = mysql_fetch_array($results)) { - if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $graph_colour = str_replace("#", "", $row_colour); @@ -33,8 +33,9 @@ if(mysql_num_rows($results)) echo(""); $i++; } + echo("
    $sensor_link_a$sensor_link_b$sensor_link_c
    "); echo("
    "); } -?> +?> \ No newline at end of file diff --git a/html/pages/device/overview/mempools.inc.php b/html/pages/device/overview/mempools.inc.php index 51ca4569c..ffd94140c 100644 --- a/html/pages/device/overview/mempools.inc.php +++ b/html/pages/device/overview/mempools.inc.php @@ -2,14 +2,17 @@ $graph_type = "mempool_usage"; -if(mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"),0)) { +if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"),0)) +{ echo("
    "); echo("

    Memory Pools

    "); echo(""); $mempool_rows = '1'; $mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); - while($mempool = mysql_fetch_array($mempools)) { - if(is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + while ($mempool = mysql_fetch_array($mempools)) + { + if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $perc = round($mempool['mempool_used'] / ($mempool['mempool_total']) * 100,2); $text_descr = rewrite_entity_descr($mempool['mempool_descr']); @@ -25,25 +28,24 @@ if(mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" $used = formatStorage($mempool['mempool_used']); $free = formatStorage($mempool['mempool_free']); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } echo(""); - $mempool_rows++; } + echo("
    " . $text_descr . " - ".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)." + ".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."
    "); echo("
    "); } - -?> +?> \ No newline at end of file diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index eba7f0e0e..a56554cd6 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -1,6 +1,7 @@ '); # ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s')); @@ -13,7 +14,6 @@ if($ports['total']) { $graph_array['legend'] = "no"; $graph = generate_graph_tag($graph_array); - $content = "
    ".$device['hostname']." - Device Traffic
    "; $content .= "
    "; $graph_array['legend'] = "yes"; @@ -30,10 +30,8 @@ if($ports['total']) { $link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $day . "/" . $config['now'] . "/"; - echo(overlib_link($link, $graph, $content, NULL)); - echo('
    '); echo(' @@ -50,14 +48,18 @@ if($ports['total']) { $sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; $query = mysql_query($sql); $ifsep = ""; - while($data = mysql_fetch_array($query)) { + + while ($data = mysql_fetch_array($query)) + { $data = ifNameDescr($data); $data = array_merge($data, $device); echo("$ifsep" . generate_port_link($data, makeshortif(strtolower($data['label'])))); $ifsep = ", "; } + unset($ifsep); echo(" "); echo(""); } -?> + +?> \ No newline at end of file diff --git a/html/pages/device/overview/processors.inc.php b/html/pages/device/overview/processors.inc.php index 75c53d9e1..119982427 100644 --- a/html/pages/device/overview/processors.inc.php +++ b/html/pages/device/overview/processors.inc.php @@ -2,15 +2,17 @@ $graph_type = "processor_usage"; -if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0)) { +if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0)) +{ $processor_rows = 0; echo("
    "); echo("

    Processors

    "); echo("
    "); $i = '1'; $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC"); - while($proc = mysql_fetch_array($procs)) { - if(is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + while ($proc = mysql_fetch_array($procs)) + { + if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/"; @@ -29,12 +31,11 @@ if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = ' $perc = $proc['processor_usage']; - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } - + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } echo(" @@ -42,10 +43,11 @@ if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = ' ".print_percentage_bar (200, 20, $perc, NULL, "ffffff", $left_background, $perc . "%", "ffffff", $right_background)." "); - $processor_rows++; + $processor_rows++; } + echo("
    " . $text_descr . "
    "); echo("
    "); } -?> +?> \ No newline at end of file diff --git a/html/pages/device/overview/storage.inc.php b/html/pages/device/overview/storage.inc.php index 10a8f448a..bdb47d917 100644 --- a/html/pages/device/overview/storage.inc.php +++ b/html/pages/device/overview/storage.inc.php @@ -2,36 +2,43 @@ $graph_type = "storage_usage"; -if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"),0)) { +if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"),0)) +{ echo("
    "); echo("

    Storage

    "); echo(""); $drive_rows = '0'; $drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC"); - while($drive = mysql_fetch_array($drives)) { - + while ($drive = mysql_fetch_array($drives)) + { $skipdrive = 0; - if ($device["os"] == "junos") { - foreach ($config['ignore_junos_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } + if ($device["os"] == "junos") + { + foreach ($config['ignore_junos_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; } - $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); + } + $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); } - if ($device['os'] == "freebsd") { - foreach ($config['ignore_bsd_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } + if ($device['os'] == "freebsd") + { + foreach ($config['ignore_bsd_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; } + } } if ($skipdrive) { continue; } - if(is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $perc = round($drive['storage_perc'], 0); $total = formatStorage($drive['storage_size']); $free = formatStorage($drive['storage_free']); @@ -45,24 +52,23 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_ $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } - - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } - echo(""); $drive_rows++; } + echo("
    " . $drive['storage_descr'] . " ".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."
    "); echo("
    "); } unset ($drive_rows); -?> +?> \ No newline at end of file diff --git a/html/pages/device/port/adsl.inc.php b/html/pages/device/port/adsl.inc.php index 57c405fe9..276f1fa70 100644 --- a/html/pages/device/port/adsl.inc.php +++ b/html/pages/device/port/adsl.inc.php @@ -1,39 +1,23 @@ ADSL Line Speed
    "); + $graph_type = "port_adsl_speed"; + include("includes/print-interface-graphs.inc.php"); - $iid = $id; - echo("
    ADSL Line Speed
    "); - $graph_type = "port_adsl_speed"; - include("includes/print-interface-graphs.inc.php"); + echo("
    ADSL Line Attenuation
    "); + $graph_type = "port_adsl_attenuation"; + include("includes/print-interface-graphs.inc.php"); - echo("
    ADSL Line Attenuation
    "); - $graph_type = "port_adsl_attenuation"; - include("includes/print-interface-graphs.inc.php"); + echo("
    ADSL Line SNR Margin
    "); + $graph_type = "port_adsl_snr"; + include("includes/print-interface-graphs.inc.php"); - echo("
    ADSL Line SNR Margin
    "); - $graph_type = "port_adsl_snr"; - include("includes/print-interface-graphs.inc.php"); + echo("
    ADSL Output Powers
    "); + $graph_type = "port_adsl_power"; + include("includes/print-interface-graphs.inc.php"); +} - echo("
    ADSL Output Powers
    "); - $graph_type = "port_adsl_power"; - include("includes/print-interface-graphs.inc.php"); - - - } - -# $graph_array['height'] = "100"; -# $graph_array['width'] = "385"; -# $graph_array['to'] = $now; -# $graph_array['port'] = $ports['fileserver']; -# $graph_array['type'] = "port_bits"; -# $graph_array['from'] = $day; -# $graph_array['legend'] = "no"; - -# $graph_array['popup_title'] = "Central Fileserver"; - -# print_graph_popup($graph_array); - - - -?> +?> \ No newline at end of file diff --git a/html/pages/device/port/graphs.inc.php b/html/pages/device/port/graphs.inc.php index e34d29e02..38b350858 100644 --- a/html/pages/device/port/graphs.inc.php +++ b/html/pages/device/port/graphs.inc.php @@ -1,30 +1,30 @@ Interface Traffic
    "); + $graph_type = "port_bits"; + include("includes/print-interface-graphs.inc.php"); - $iid = $id; - echo("
    Interface Traffic
    "); - $graph_type = "port_bits"; + echo("
    Interface Packets
    "); + $graph_type = "port_upkts"; + include("includes/print-interface-graphs.inc.php"); + + echo("
    Interface Non Unicast
    "); + $graph_type = "port_nupkts"; + include("includes/print-interface-graphs.inc.php"); + + echo("
    Interface Errors
    "); + $graph_type = "port_errors"; + include("includes/print-interface-graphs.inc.php"); + + if (is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . $interface['ifIndex'] . "-dot3.rrd")) + { + echo("
    Ethernet Errors
    "); + $graph_type = "port_etherlike"; include("includes/print-interface-graphs.inc.php"); - - echo("
    Interface Packets
    "); - $graph_type = "port_upkts"; - include("includes/print-interface-graphs.inc.php"); - - echo("
    Interface Non Unicast
    "); - $graph_type = "port_nupkts"; - include("includes/print-interface-graphs.inc.php"); - - echo("
    Interface Errors
    "); - $graph_type = "port_errors"; - include("includes/print-interface-graphs.inc.php"); - - if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . $interface['ifIndex'] . "-dot3.rrd")) { - echo("
    Ethernet Errors
    "); - $graph_type = "port_etherlike"; - include("includes/print-interface-graphs.inc.php"); - } } +} - -?> +?> \ No newline at end of file diff --git a/html/pages/device/port/junose-atm-vp.inc.php b/html/pages/device/port/junose-atm-vp.inc.php index eaebce14a..3edbc50dc 100644 --- a/html/pages/device/port/junose-atm-vp.inc.php +++ b/html/pages/device/port/junose-atm-vp.inc.php @@ -1,39 +1,42 @@ "); +echo(''); - $vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"); - while($vp = mysql_fetch_array($vps)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - echo(''); - echo(''); - echo(''); +$vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"); +while ($vp = mysql_fetch_array($vps)) +{ + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + echo(''); + echo(''); + echo(''); - $graph_array['height'] = "100"; - $graph_array['width'] = "214"; - $graph_array['to'] = $now; - $graph_array['id'] = $vp['juniAtmVp_id']; - $graph_array['type'] = $graph_type; + $graph_array['height'] = "100"; + $graph_array['width'] = "214"; + $graph_array['to'] = $now; + $graph_array['id'] = $vp['juniAtmVp_id']; + $graph_array['type'] = $graph_type; - $periods = array('day', 'week', 'month', 'year'); - - echo('"); - - $row++; + $periods = array('day', 'week', 'month', 'year'); + echo(''); - echo("
    '.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'
    '.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'
    '); - foreach($periods as $period) { - $graph_array['from'] = $$period; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); - } - echo("
    '); + + foreach ($periods as $period) + { + $graph_array['from'] = $$period; + $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); } + + echo('
    "); + $row++; +} -?> +echo(''); + +?> \ No newline at end of file diff --git a/html/pages/device/port/macaccounting.inc.php b/html/pages/device/port/macaccounting.inc.php index 1f03c0095..0b1091b2b 100644 --- a/html/pages/device/port/macaccounting.inc.php +++ b/html/pages/device/port/macaccounting.inc.php @@ -1,204 +1,218 @@ Disabled"; } - if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } - if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } +$color = "black"; +if ($interface['ifAdminStatus'] == "down") { $status = "Disabled"; } +if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } +if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } - $i = 1; - $inf = fixifName($ifname); +$i = 1; +$inf = fixifName($ifname); - echo("
    "); +echo("
    "); - if($_GET['optd'] == "top10") { - if($_GET['opte']) { - $period = $_GET['opte']; - } else { $period = "1day"; } - $from = "-" . $period; - if($_GET['optc']) { - $stat = $_GET['optc']; - } else { $stat = "bits"; } - if($_GET['optf']) { - $sort = $_GET['optf']; - } else { $sort = "in"; } +if ($_GET['optd'] == "top10") +{ + if ($_GET['opte']) + { + $period = $_GET['opte']; + } else { $period = "1day"; } + $from = "-" . $period; + if ($_GET['optc']) + { + $stat = $_GET['optc']; + } else { $stat = "bits"; } - echo("
    -
    - -
    - Two Day
    - - + if ($_GET['optf']) + { + $sort = $_GET['optf']; + } else { $sort = "in"; } + + echo("
    +
    + +
    + Two Day
    + + + +
    +
    + Week
    + +
    - Week
    - - - -
    -
    - Month
    - - - -
    -
    - Year
    - - - -
    -
    -
    - -
    -
    -
    - Traffic
    - - + Month
    +
    +
    +
    + Year
    + + + +
    +
    +
    + +
    +
    - Packets
    - - - -
    -
    - Top Input
    - - - -
    -
    - Top Output
    - - - -
    -
    - Top Aggregate
    - - - -
    -
    -
    + Traffic
    + + + +
    +
    + Packets
    + + + +
    +
    + Top Input
    + + + +
    +
    + Top Output
    + + + +
    +
    + Top Aggregate
    + + + +
    +
    +
    "); - unset($query); - } else { + unset($query); + } + else + { - $query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M, - `ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id - AND I.device_id = D.device_id ORDER BY bps DESC"); + $query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M, + `ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id + AND I.device_id = D.device_id ORDER BY bps DESC"); - while($acc = mysql_fetch_array($query)) { - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); - $name = gethostbyaddr($addy['ipv4_address']); + while ($acc = mysql_fetch_array($query)) + { + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); + $name = gethostbyaddr($addy['ipv4_address']); - $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); - if($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); } + $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + if ($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); } + + if ($name == $addy['ipv4_address']) { unset ($name); } + if (mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) + { + $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); + $peer_info = mysql_fetch_array($peer_query); + } else { unset ($peer_info); } + + if ($peer_info) + { + $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; + } else { + unset ($as); unset ($astext); unset($asn); + } + + if ($_GET['optc']) + { + $graph_type = "port_mac_acc_" . $_GET['optc']; + } else { + $graph_type = "port_mac_acc_bits"; + } + + if ($_GET['optd'] == "thumbs") + { + if (!$asn) { $asn = "No Session"; } + + echo("
    + ".$addy['ipv4_address']." - ".$asn." + ".$name." - ".$addy['ipv4_address']." - ".$asn."
    \ + \ + ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" > + + + ".$name." +
    "); - if($name == $addy['ipv4_address']) { unset ($name); } - if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) { - $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); - $peer_info = mysql_fetch_array($peer_query); - } else { unset ($peer_info); } - if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else { - unset ($as); unset ($astext); unset($asn); } + else + { + echo("
    "); - if($_GET['optc']) { - $graph_type = "port_mac_acc_" . $_GET['optc']; - } else { - $graph_type = "port_mac_acc_bits"; - } + echo(" + + + + + + + + +
    ".mac_clean_to_readable($acc['mac'])."".$addy['ipv4_address']."".$name." ".$arp_name . "".formatRates($acc['cipMacHCSwitchedBytes_input_rate'] / 8)."".formatRates($acc['cipMacHCSwitchedBytes_output_rate'] / 8)."
    + "); - if($_GET['optd'] == "thumbs") { + $peer_info['astext']; - if(!$asn) { $asn = "No Session"; } + $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; + $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; + $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; + $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; + $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; + $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; + $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; + $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; - echo("
    - ".$addy['ipv4_address']." - ".$asn." - ".$name." - ".$addy['ipv4_address']." - ".$asn."
    \ - \ - ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" > - + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); - ".$name." -
    "); - - } else { - - echo("
    "); - - echo(" - - - - - - - - -
    ".mac_clean_to_readable($acc['mac'])."".$addy['ipv4_address']."".$name." ".$arp_name . "".formatRates($acc['cipMacHCSwitchedBytes_input_rate'] / 8)."".formatRates($acc['cipMacHCSwitchedBytes_output_rate'] / 8)."
    - "); - - $peer_info['astext']; - - $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; - $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; - $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; - $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; - $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; - $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; - $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; - $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; - - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> - "); - - echo("
    "); - $i++; - } + echo("
    "); + $i++; + } + } } -} - -?> +?> \ No newline at end of file diff --git a/html/pages/device/port/pagp.inc.php b/html/pages/device/port/pagp.inc.php index 57b88c819..2c0066309 100644 --- a/html/pages/device/port/pagp.inc.php +++ b/html/pages/device/port/pagp.inc.php @@ -1,37 +1,35 @@ ', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> - "); +echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); +echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); +echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); +echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); +$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); +while ($member = mysql_fetch_array($members)) +{ + echo("$br " . generate_port_link($member) . " (PAgP)"); + $br = "
    "; +} - - $members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); - while($member = mysql_fetch_array($members)) { - echo("$br " . generate_port_link($member) . " (PAgP)"); - $br = "
    "; - } - - -?> +?> \ No newline at end of file diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index db545e896..b1d9f0755 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -1,42 +1,44 @@ Basic | -Details | -ARP Table | +echo("Basic | +Details | +ARP Table | ADSL | Graphs: "); $graph_types = array("bits" => "Bits", "upkts" => "Unicast Packets", - "nupkts" => "Non-Unicast Packets", - "errors" => "Errors", + "nupkts" => "Non-Unicast Packets", + "errors" => "Errors", "etherlike" => "Etherlike"); -foreach ($graph_types as $type => $descr) { - echo("$type_sep - $descr +foreach ($graph_types as $type => $descr) +{ + echo("$type_sep + $descr (Mini) "); $type_sep = " | "; } - print_optionbar_end(); -if($_GET['optc'] == thumbs) { - +if ($_GET['optc'] == thumbs) +{ $timeperiods = array('-1day','-1week','-1month','-1year'); $from = '-1day'; echo("
    "); $sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_assoc($query)) { + while ($interface = mysql_fetch_assoc($query)) + { echo("
    ".makeshortif($interface['ifDescr'])."
    "); } else { - if($_GET['opta'] == "arp" ) { + if ($_GET['opta'] == "arp" ) + { include("arp.inc.php"); - } elseif($_GET['opta'] == "adsl") { + } elseif ($_GET['opta'] == "adsl") { echo("
    "); echo(""); $i = "0"; $interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC"); - while($interface = mysql_fetch_assoc($interface_query)) { + while ($interface = mysql_fetch_assoc($interface_query)) + { include("includes/print-interface-adsl.inc.php"); $i++; } echo("
    PortTrafficSync SpeedAttainable SpeedAttenuationSNR MarginOutput Powers
    "); echo("
    "); } else { - if($_GET['opta'] == "details" ) { $port_details = 1; } + if ($_GET['opta'] == "details" ) { $port_details = 1; } echo("
    "); $i = "1"; $interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC"); - while($interface = mysql_fetch_assoc($interface_query)) { + while ($interface = mysql_fetch_assoc($interface_query)) + { include("includes/print-interface.inc.php"); - $i++; + $i++; } echo("
    "); echo("
    "); } } -?> +?> \ No newline at end of file diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index af99abe72..e369084bd 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -2,13 +2,14 @@ include("includes/geshi/geshi.php"); -if($_SESSION['userlevel'] >= "7") { +if ($_SESSION['userlevel'] >= "7") +{ + if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } - if(!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } - - foreach($config['rancid_configs'] as $configs) { + foreach ($config['rancid_configs'] as $configs) + { if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; } - if(is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; } + if (is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; } } $fh = fopen($file, 'r') or die("Can't open file"); @@ -24,12 +25,13 @@ if($_SESSION['userlevel'] >= "7") { } $text = join("\n",$lines); } + $language = "ios"; $geshi = new GeSHi($text, $language); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_overall_style('color: black;'); - #$geshi->set_line_style('color: #999999'); + #$geshi->set_line_style('color: #999999'); echo($geshi->parse_code()); } -?> +?> \ No newline at end of file diff --git a/html/pages/device/srv.inc.php b/html/pages/device/srv.inc.php index 1e0d2e5c1..3d9ec7d2b 100644 --- a/html/pages/device/srv.inc.php +++ b/html/pages/device/srv.inc.php @@ -1,22 +1,20 @@ '0') { - - echo("
    "); - $i = "1"; - $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); - while($service = mysql_fetch_array($service_query)) { - - include("includes/print-service.inc"); - } - echo("
    "); - -} else { +if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '".$device['device_id']."'"), 0) > '0') +{ + echo("
    "); + $i = "1"; + $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); + while ($service = mysql_fetch_array($service_query)) + { + include("includes/print-service.inc"); + } + echo("
    "); +} +else +{ echo("No Services"); - } - -?> - +?> \ No newline at end of file diff --git a/html/pages/device/syslog.inc.php b/html/pages/device/syslog.inc.php index eb8d6518c..83ea15041 100644 --- a/html/pages/device/syslog.inc.php +++ b/html/pages/device/syslog.inc.php @@ -1,6 +1,6 @@ - @@ -14,9 +14,9 @@ print_optionbar_start('25'); ".$data['program'].""); } ?> @@ -29,11 +29,13 @@ print_optionbar_start('25'); print_optionbar_end(); -if($_POST['string']) { +if ($_POST['string']) +{ $where = " AND msg LIKE '%".$_POST['string']."%'"; } -if($_POST['program']) { +if ($_POST['program']) +{ $where .= " AND program = '".$_POST['program']."'"; } @@ -41,7 +43,7 @@ $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE $sql .= " ORDER BY timestamp DESC LIMIT 1000"; $query = mysql_query($sql); echo(""); -while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } +while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/device/vlans.inc.php b/html/pages/device/vlans.inc.php index d6412432b..43c09c9ae 100644 --- a/html/pages/device/vlans.inc.php +++ b/html/pages/device/vlans.inc.php @@ -3,22 +3,25 @@ print_optionbar_start(); echo("
    - Basic | Graphs : + Basic | Graphs : Bits | - Packets | - NU Packets | + Packets | + NU Packets | Errors "); print_optionbar_end(); +echo(''); - echo("
    "); - $i = "1"; - $vlan_query = mysql_query("select * from vlans WHERE device_id = '".$_GET['id']."' ORDER BY 'vlan_vlan'"); - while($vlan = mysql_fetch_array($vlan_query)) { - include("includes/print-vlan.inc.php"); - $i++; - } - echo("
    "); +$i = "1"; +$vlan_query = mysql_query("select * from vlans WHERE device_id = '".mres($_GET['id'])."' ORDER BY 'vlan_vlan'"); -?> +while ($vlan = mysql_fetch_array($vlan_query)) +{ + include("includes/print-vlan.inc.php"); + $i++; +} + +echo(""); + +?> \ No newline at end of file diff --git a/html/pages/device/vrfs.inc.php b/html/pages/device/vrfs.inc.php index e0474093e..ae7ffa0f3 100644 --- a/html/pages/device/vrfs.inc.php +++ b/html/pages/device/vrfs.inc.php @@ -11,14 +11,15 @@ echo(" "); print_optionbar_end(); +echo("
    "); +$i = "0"; +$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'"); +while ($vrf = mysql_fetch_array($vrf_query)) +{ + include("includes/print-vrf.inc"); + $i++; +} - echo("
    "); - $i = "0"; - $vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'"); - while($vrf = mysql_fetch_array($vrf_query)) { - include("includes/print-vrf.inc"); - $i++; - } - echo("
    "); +echo("
    "); -?> +?> \ No newline at end of file