');
-
-if(device_permitted($_GET['id']) && $config['show_overview_tab']) {
-echo("
--
-
-
Overview
-
- ");
-}
-
-if(device_permitted($_GET['id'])) {
- echo('-
-
-
Graphs
-
- ');
-}
-
-if(device_permitted($_GET['id'])) {
-
- $health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
- mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
-
- if($health) {
- echo('-
-
-
Health
-
- ');
- }
-}
-
-if(device_permitted($_GET['id']) && @mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
{
- echo('-
-
-
Apps
-
- ');
-}
+ $selected['iface'] = "selected";
-### This needs to die, rolled into generic sensors! (still need to implement booleans, tx/rx powers and currents)
+ $section = str_replace(".", "", mres($_GET['section']));
-#$cisco_sensors = mysql_result(mysql_query("SELECT count(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%'"),0);
-#if($cisco_sensors) {
-# echo('-
-#
-#
Sensors
-#
-# ');
-#}
+ if (!$section)
+ {
+ $section = "overview";
+ }
-if(device_permitted($_GET['id']) && is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
- echo('-
-
-
CollectD
-
- ');
-}
+ $select[$section] = "selected";
-if(device_permitted($_GET['id']) && @mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
- echo('-
-
-
Ports
-
- ');
-}
+ $device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'");
+ while($device = mysql_fetch_array($device_query))
+ {
+ if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; }
-if(device_permitted($_GET['id']) && @mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
- echo('-
-
-
VLANs
-
- ');
-}
+ echo('');
+ include("includes/device-header.inc.php");
+ echo('
');
-if(device_permitted($_GET['id']) && @mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
- echo('-
-
-
VRFs
-
- ');
-}
+ echo('');
+ echo('
');
-if(device_permitted($_GET['id']) && $config['enable_bgp'] && $device['bgpLocalAs']) {
- echo('-
-
-
BGP
-
- ');
-}
-
-### This probably needs to die? DEATH TO NAGIOS!
-
-#if(@mysql_result(mysql_query("SELECT count(*) FROM nagios_hosts WHERE address = '".$device['hostname']."'", $nagios_link), 0) > '0') {
-# echo('-
-#
-#
Nagios
-#
-# ');
-#}
-
-
-if($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0)) {
- echo('-
-
-
Map
-
- ');
-}
-
-if(device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
- echo('-
-
-
Inventory
-
- ');
-} elseif ( device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
- echo('-
-
-
Inventory
-
- ');
-}
-
-if(device_permitted($_GET['id']) && mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
- echo('-
-
-
Services
-
-
-');
-}
-
-if(device_permitted($_GET['id']) && @mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
- echo('-
-
-
Toner
-
- ');
-}
-
-if(device_permitted($_GET['id'])) {
- echo('-
-
-
Events
+ if (device_permitted($_GET['id']))
+ {
+ if ($config['show_overview_tab'])
+ {
+ echo('
+ -
+
+
Overview
');
-}
+ }
-if(device_permitted($_GET['id']) && $config['enable_syslog']) {
-echo('-
-
-
Syslog
-
-
-');
-}
+ echo('-
+
+
Graphs
+
+ ');
+
+ $health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
+ mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
+
+ if ($health)
+ {
+ echo('-
+
+
Health
+
+ ');
+ }
+
+ if (@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('-
+
+
Apps
+
+ ');
+ }
+
+ if (is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
+ echo('-
+
+
CollectD
+
+ ');
+ }
+
+ if (@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
+ echo('-
+
+
Ports
+
+ ');
+ }
+
+ if (@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('-
+
+
VLANs
+
+ ');
+ }
+
+ if (@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('-
+
+
VRFs
+
+ ');
+ }
+
+ if ($config['enable_bgp'] && $device['bgpLocalAs'])
+ {
+ echo('-
+
+
BGP
+
+ ');
+ }
+
+ if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
+ {
+ echo('-
+
+
Map
+
+ ');
+ }
+
+ if ($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
+ {
+ echo('-
+
+
Inventory
+
+ ');
+ }
+ elseif ( device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
+ {
+ echo('-
+
+
Inventory
+
+ ');
+ }
+
+ if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('-
+
+
Services
+
+ ');
+ }
+
+ if (@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('-
+
+
Toner
+
+ ');
+ }
+
+ if (device_permitted($_GET['id']))
+ {
+ echo('-
+
+
Events
+
+ ');
+ }
+
+ if ($config['enable_syslog'])
+ {
+ echo('-
+
+
Syslog
+
+
+ ');
+ }
+ }
+ if ($_SESSION['userlevel'] >= "7") {
+ if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
+ foreach($config['rancid_configs'] as $configs) {
+ if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
+ if (is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; }
+ }
+ }
+ if ($device_config_file) {
+ echo('-
+
+
Config
+
+
+ ');
+ }
-if($_SESSION['userlevel'] >= "7") {
- if(!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
- foreach($config['rancid_configs'] as $configs) {
- if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
- if(is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; }
+ if ($_SESSION['userlevel'] >= "7") {
+ echo('-
+
+
Settings
+
+
+ ');
+ }
+
+ echo("
");
+ echo('
');
+
+ ## FIXME safe??
+ include("pages/device/".mres($section).".inc.php");
+
+ echo("
");
}
}
-if($device_config_file) {
- echo('
-
-
-
Config
-
-
-');
+else
+{
+ include("includes/error-no-perm.inc.php");
}
-
-if($_SESSION['userlevel'] >= "7") {
- echo('
-
-
-
Settings
-
-
-');
-}
-
-
-echo("");
-echo('
-
');
-
-## FIXME safe??
-include("pages/device/".mres($section).".inc.php");
-
-
-echo("
-");
-}
-
-} else { include("includes/error-no-perm.inc.php"); }
?>
-
+
\ No newline at end of file