';
echo '
';
require 'includes/device-header.inc.php';
echo '
';
echo '';
if (device_permitted($device['device_id'])) {
echo '';
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 mempools 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 (@dbFetchCell("SELECT 1 FROM processes WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Processes
';
}
if (isset($config['collectd_dir']) && is_dir($config['collectd_dir'].'/'.$device['hostname'].'/')) {
echo '-
CollectD
';
}
if (@dbFetchCell("SELECT COUNT(mplug_id) FROM munin_plugins WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Munin
';
}
if (@dbFetchCell("SELECT COUNT(port_id) FROM ports WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Ports
';
}
if (@dbFetchCell("SELECT COUNT(sla_id) FROM slas WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
SLAs
';
}
if (@dbFetchCell("SELECT COUNT(accesspoint_id) FROM access_points WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Access Points
';
}
$smokeping_files = get_smokeping_files($device);
if (count($smokeping_files['in'][$device['hostname']]) || count($smokeping_files['out'][$device['hostname']])) {
echo '-
Ping
';
}
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
';
}
// $loadbalancer_tabs is used in device/loadbalancer/ to build the submenu. we do it here to save queries
if ($device['os'] == 'netscaler')
// Netscaler
{
$device_loadbalancer_count['netscaler_vsvr'] = dbFetchCell('SELECT COUNT(*) FROM `netscaler_vservers` WHERE `device_id` = ?', array($device['device_id']));
if ($device_loadbalancer_count['netscaler_vsvr']) {
$loadbalancer_tabs[] = 'netscaler_vsvr';
}
}
if ($device['os'] == 'acsw') {
// Cisco ACE
$device_loadbalancer_count['loadbalancer_vservers'] = dbFetchCell('SELECT COUNT(*) FROM `loadbalancer_vservers` WHERE `device_id` = ?', array($device['device_id']));
if ($device_loadbalancer_count['loadbalancer_vservers']) {
$loadbalancer_tabs[] = 'loadbalancer_vservers';
}
}
if (is_array($loadbalancer_tabs)) {
echo '-
Load Balancer
';
}
// $routing_tabs is used in device/routing/ to build the tabs menu. we built it here to save some queries
$device_routing_count['loadbalancer_rservers'] = dbFetchCell('SELECT COUNT(*) FROM `loadbalancer_rservers` WHERE `device_id` = ?', array($device['device_id']));
if ($device_routing_count['loadbalancer_rservers']) {
$routing_tabs[] = 'loadbalancer_rservers';
}
$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
';
}
$device_pw_count = @dbFetchCell('SELECT COUNT(*) FROM `pseudowires` WHERE `device_id` = ?', array($device['device_id']));
if ($device_pw_count) {
echo '-
Pseudowires
';
}
echo('-
Map
');
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Pkgs
';
}
if ($config['enable_inventory'] && @dbFetchCell("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."'") > '0') {
echo '-
Inventory
';
}
else if (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 '-
Logs
';
}
if (device_permitted($device['device_id'])) {
echo '-
Alerts
';
}
if (device_permitted($device['device_id'])) {
echo '-
Alert Stats
';
}
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 ($config['oxidized']['enabled'] === true && isset($config['oxidized']['url'])) {
$device_config_file = true;
}
}
if ($device_config_file) {
if (dbFetchCell("SELECT COUNT(device_id) FROM devices_attribs WHERE device_id = ? AND attrib_type = 'override_Oxidized_disable' AND attrib_value='true'",array($device['device_id']) ) == '0') {
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.$nfsen_filename.'.rrd';
}
}
}//end if
if ($nfsen_rrd_file) {
echo '-
Netflow
';
}
if (can_ping_device($attribs) === true) {
echo '-
Performance
';
}
echo '-
Notes
';
echo '![Launch browser to https://'.$device['hostname'].' https](images/16/http.png)
![SSH to '.$device['hostname'].' ssh](images/16/ssh.png)
![Telnet to '.$device['hostname'].' telnet](images/16/telnet.png)
';
if ($_SESSION['userlevel'] >= '7') {
echo '-
';
}
echo '
';
}//end if
if (device_permitted($device['device_id']) || $check_device == $vars['device']) {
echo '';
require 'pages/device/'.mres(basename($tab)).'.inc.php';
echo '
';
}
else {
require 'includes/error-no-perm.inc.php';
}
}//end if