');
#include("includes/hostbox.inc.php");
include("includes/device-header.inc.php");
echo('');
echo('
');
echo('
');
if (device_permitted($device['device_id']))
{
if ($config['show_overview_tab'])
{
echo('
-
Overview
');
}
echo('-
Graphs
');
$health = dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '" . $device['device_id'] . "'") +
dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '" . $device['device_id'] . "'") +
dbFetchCell("SELECT COUNT(*) FROM cempMemPool WHERE device_id = '" . $device['device_id'] . "'") +
dbFetchCell("SELECT COUNT(*) FROM cpmCPU WHERE device_id = '" . $device['device_id'] . "'") +
dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '" . $device['device_id'] . "'");
if ($health)
{
echo('-
Health
');
}
if (@dbFetchCell("SELECT COUNT(app_id) FROM applications WHERE device_id = '" . $device['device_id'] . "'") > '0')
{
echo('-
Apps
');
}
if (isset($config['collectd_dir']) && is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/"))
{
echo('-
CollectD
');
}
if (@dbFetchCell("SELECT COUNT(interface_id) FROM ports WHERE device_id = '" . $device['device_id'] . "'") > '0')
{
echo('-
Ports
');
}
if (isset($config['smokeping']['dir']))
{
$smokeping_files = array();
if ($handle = opendir($config['smokeping']['dir']))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
if (eregi(".rrd", $file))
{
if (eregi("~", $file))
{
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
$smokeping_files['in'][$target][$slave] = $file;
$smokeping_files['out'][$slave][$target] = $file;
} else {
$target = str_replace(".rrd", "", $file);
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
}
}
}
}
}
}
if (count($smokeping_files))
{
echo('-
Latency
');
}
if (@dbFetchCell("SELECT COUNT(vlan_id) FROM vlans WHERE device_id = '" . $device['device_id'] . "'") > '0')
{
echo('-
VLANs
');
}
if (@dbFetchCell("SELECT COUNT(id) FROM vminfo WHERE device_id = '" . $device["device_id"] . "'") > '0')
{
echo('-
Virtual Machines
');
}
### $routing_tabs is used in device/routing/ to build the tabs menu. we built it here to save some queries
$device_routing_count['ipsec_tunnels'] = dbFetchCell("SELECT COUNT(*) FROM `ipsec_tunnels` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['ipsec_tunnels']) { $routing_tabs[] = 'ipsec_tunnels'; }
$device_routing_count['bgp'] = dbFetchCell("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['bgp']) { $routing_tabs[] = 'bgp'; }
$device_routing_count['ospf'] = dbFetchCell("SELECT COUNT(*) FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled' AND `device_id` = ?", array($device['device_id']));
if ($device_routing_count['ospf']) { $routing_tabs[] = 'ospf'; }
$device_routing_count['cef'] = dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['cef']) { $routing_tabs[] = 'cef'; }
$device_routing_count['vrf'] = @dbFetchCell("SELECT COUNT(*) FROM `vrfs` WHERE `device_id` = ?", array($device['device_id']));
if ($device_routing_count['vrf']) { $routing_tabs[] = 'vrf'; }
if (is_array($routing_tabs))
{
echo('-
Routing
');
}
if ($_SESSION['userlevel'] >= "5" && dbFetchCell("SELECT COUNT(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"))
{
$discovery_links = TRUE;
echo('-
Map
');
}
if ($config['enable_inventory'] && @dbFetchCell("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."'") > '0')
{
echo('-
Inventory
');
}
elseif (device_permitted($device['device_id']) && $config['enable_inventory'] && @dbFetchCell("SELECT * FROM `hrDevice` WHERE device_id = '".$device['device_id']."'") > '0')
{
echo('-
Inventory
');
}
if (dbFetchCell("SELECT COUNT(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "'") > '0')
{
echo('-
Services
');
}
if (@dbFetchCell("SELECT COUNT(toner_id) FROM toner WHERE device_id = '" . $device['device_id'] . "'") > '0')
{
echo('-
Toner
');
}
if (device_permitted($device['device_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 ($config['nfsen_enable'])
{
if (!is_array($config['nfsen_rrds'])) { $config['nfsen_rrds'] = array($config['nfsen_rrds']); }
foreach ($config['nfsen_rrds'] as $nfsenrrds)
{
if ($configs[strlen($nfsenrrds)-1] != '/') { $nfsenrrds .= '/'; }
$nfsensuffix = "";
if ($config['nfsen_suffix']) { $nfsensuffix = $config['nfsen_suffix']; }
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
$nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true));
if (is_file($nfsenrrds . $nfsen_filename . ".rrd")) { $nfsen_rrd_file = $nfsenrrds . $basefilename_underscored . ".rrd"; }
}
}
if ($nfsen_rrd_file)
{
echo('-
Netflow
');
}
if ($_SESSION['userlevel'] >= "7")
{
echo('-
Settings
');
}
echo("
");
}
if (device_permitted($device['device_id']) || $check_device == $vars['device']) {
echo('
');
include("pages/device/".mres(basename($tab)).".inc.php");
echo("
");
} else {
include("includes/error-no-perm.inc.php");
}
}
?>