2009-09-07 11:07:59 +00:00
<? php
2007-04-03 14:10:23 +00:00
2015-05-11 09:43:20 +02:00
if ( ! is_numeric ( $vars [ 'device' ])) {
2017-03-22 03:06:46 -05:00
$vars [ 'device' ] = getidbyname ( $vars [ 'device' ]);
2015-05-10 19:11:12 +02:00
}
2012-05-21 18:17:23 +00:00
2017-03-22 03:06:46 -05:00
$permitted_by_port = $vars [ 'tab' ] == 'port' && port_permitted ( $vars [ 'port' ], $vars [ 'device' ]);
2007-04-03 14:10:23 +00:00
2017-03-22 03:06:46 -05:00
if ( device_permitted ( $vars [ 'device' ]) || $permitted_by_port ) {
if ( empty ( $vars [ 'tab' ])) {
2015-07-13 20:10:26 +02:00
$tab = 'overview' ;
2017-03-22 03:06:46 -05:00
} else {
$tab = str_replace ( '.' , '' , $vars [ 'tab' ]);
2011-03-31 17:19:54 +00:00
}
2017-03-22 03:06:46 -05:00
$select = array ( $tab => 'class="active"' );
2007-04-15 14:38:26 +00:00
2017-03-22 03:06:46 -05:00
$device = device_by_id_cache ( $vars [ 'device' ]);
2015-07-13 20:10:26 +02:00
$attribs = get_dev_attribs ( $device [ 'device_id' ]);
2017-01-22 09:49:13 +00:00
$device [ 'attribs' ] = $attribs ;
2017-01-09 02:16:09 -06:00
load_os ( $device );
2015-01-15 07:18:10 +00:00
2015-07-13 20:10:26 +02:00
$entity_state = get_dev_entity_state ( $device [ 'device_id' ]);
2009-03-11 14:46:55 +00:00
2015-07-13 20:10:26 +02:00
// print_r($entity_state);
2017-05-05 12:25:58 +01:00
$pagetitle [] = format_hostname ( $device , $device [ 'hostname' ]);
2007-04-03 14:10:23 +00:00
2017-01-19 18:19:11 +10:00
$component = new LibreNMS\Component ();
$component_count = $component -> getComponentCount ( $device [ 'device_id' ]);
2017-02-24 03:59:30 -06:00
$alert_class = '' ;
if ( $device [ 'disabled' ] == '1' ) {
$alert_class = 'alert-info' ;
} else {
if ( $device [ 'status' ] == '0' ) {
$alert_class = 'alert-danger' ;
} elseif ( $device [ 'ignore' ] == '1' ) {
$alert_class = 'alert-warning' ;
}
}
2015-09-23 01:17:29 +05:30
echo '<div class="panel panel-default">' ;
2017-02-24 03:59:30 -06:00
echo '<div class="panel-body ' . $alert_class . '">' ;
2015-09-23 01:17:29 +05:30
require 'includes/device-header.inc.php' ;
2017-02-24 03:59:30 -06:00
echo '</div>' ;
2015-09-23 01:17:29 +05:30
echo '</div>' ;
2012-04-06 13:56:23 +00:00
2009-03-11 15:30:01 +00:00
2015-07-13 20:10:26 +02:00
if ( device_permitted ( $device [ 'device_id' ])) {
echo '<ul class="nav nav-tabs">' ;
2011-09-23 16:52:44 +00:00
2015-07-13 20:10:26 +02:00
if ( $config [ 'show_overview_tab' ]) {
echo '
2017-03-22 03:06:46 -05:00
<li role="presentation" ' . $select [ 'overview' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'overview' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-lightbulb-o fa-lg icon-theme" aria-hidden="true"></i> Overview
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2012-03-19 10:36:22 +00:00
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'graphs' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'graphs' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-area-chart fa-lg icon-theme" aria-hidden="true"></i> Graphs
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
2007-04-15 14:38:26 +00:00
2017-10-31 15:35:49 -05:00
$health = dbFetchCell ( "SELECT COUNT(*) FROM storage WHERE device_id = ?" , array ( $device [ 'device_id' ])) +
dbFetchCell ( "SELECT COUNT(*) FROM sensors WHERE device_id = ?" , array ( $device [ 'device_id' ])) +
dbFetchCell ( "SELECT COUNT(*) FROM mempools WHERE device_id = ?" , array ( $device [ 'device_id' ])) +
dbFetchCell ( "SELECT COUNT(*) FROM processors WHERE device_id = ?" , array ( $device [ 'device_id' ])) +
2015-07-01 08:14:23 +10:00
count_mib_health ( $device );
2011-03-07 16:23:45 +00:00
2015-07-13 20:10:26 +02:00
if ( $health ) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'health' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'health' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-heartbeat fa-lg icon-theme" aria-hidden="true"></i> Health
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2015-01-15 07:18:10 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM applications WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'apps' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'apps' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-cubes fa-lg icon-theme" aria-hidden="true"></i> Apps
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2009-03-11 14:46:55 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM processes WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'processes' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'processes' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-microchip fa-lg icon-theme" aria-hidden="true"></i> Processes
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2007-11-21 14:26:24 +00:00
2015-07-13 20:10:26 +02:00
if ( isset ( $config [ 'collectd_dir' ]) && is_dir ( $config [ 'collectd_dir' ] . '/' . $device [ 'hostname' ] . '/' )) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'collectd' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'collectd' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-pie-chart fa-lg icon-theme" aria-hidden="true"></i> CollectD
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2012-05-11 13:26:14 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM munin_plugins WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'munin' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'munin' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-pie-chart fa-lg icon-theme" aria-hidden="true"></i> Munin
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2007-04-03 14:10:23 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM ports WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'ports' ] . $select [ 'port' ] . '">
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'ports' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-link fa-lg icon-theme" aria-hidden="true"></i> Ports
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2012-04-09 12:53:44 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM slas WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'slas' ] . $select [ 'sla' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'slas' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-flag fa-lg icon-theme" aria-hidden="true"></i> SLAs
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2012-05-21 18:17:23 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( 'SELECT 1 FROM `wireless_sensors` WHERE `device_id`=?' , array ( $device [ 'device_id' ]))) {
2017-05-01 23:49:11 -05:00
echo '<li role="presentation" ' . $select [ 'wireless' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'wireless' )) . '">
<i class="fa fa-wifi fa-lg icon-theme" aria-hidden="true"></i> Wireless
</a>
</li>' ;
}
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM access_points WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'accesspoints' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'accesspoints' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-wifi fa-lg icon-theme" aria-hidden="true"></i> Access Points
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
2011-09-30 19:46:32 +00:00
}
2015-07-15 20:46:04 +01:00
$smokeping_files = get_smokeping_files ( $device );
2015-07-13 20:10:26 +02:00
if ( count ( $smokeping_files [ 'in' ][ $device [ 'hostname' ]]) || count ( $smokeping_files [ 'out' ][ $device [ 'hostname' ]])) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'latency' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'latency' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-crosshairs fa-lg icon-theme" aria-hidden="true"></i> Ping
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2011-09-30 19:46:32 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM vlans WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'vlans' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'vlans' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-tasks fa-lg icon-theme" aria-hidden="true"></i> VLANs
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2010-03-12 17:46:25 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM vminfo WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'vm' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'vm' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-cog fa-lg icon-theme" aria-hidden="true"></i> Virtual Machines
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM mefinfo WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'mef' ] . '>
2017-03-11 14:30:31 +01:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'mef' )) . '">
<i class="fa fa-link fa-lg icon-theme" aria-hidden="true"></i> Metro Ethernet
</a>
</li>' ;
}
2011-03-26 17:16:09 +00:00
2017-04-12 11:39:02 +02:00
if ( $device [ 'os' ] == 'coriant' ) {
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM tnmsneinfo WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-04-12 11:39:02 +02:00
echo '<li class="' . $select [ 'tnmsne' ] . '">
<a href="' . generate_device_url ( $device , array ( 'tab' => 'tnmsne' )) . '">
<i class="fa fa-link fa-lg icon-theme" aria-hidden="true"></i> Hardware
</a>
</li>' ;
}
}
2015-07-13 20:10:26 +02:00
// $loadbalancer_tabs is used in device/loadbalancer/ to build the submenu. we do it here to save queries
2016-08-18 20:28:22 -05:00
if ( $device [ 'os' ] == 'netscaler' ) {
2015-07-13 20:10:26 +02:00
// 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' ;
}
}
2011-04-17 15:55:38 +00:00
2015-07-13 20:10:26 +02:00
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' ;
}
}
2012-01-18 08:12:37 +00:00
2017-01-19 18:19:11 +10:00
// F5 LTM
if ( isset ( $component_count [ 'f5-ltm-vs' ])) {
$device_loadbalancer_count [ 'ltm_vs' ] = $component_count [ 'f5-ltm-vs' ];
$loadbalancer_tabs [] = 'ltm_vs' ;
}
if ( isset ( $component_count [ 'f5-ltm-pool' ])) {
$device_loadbalancer_count [ 'ltm_pool' ] = $component_count [ 'f5-ltm-pool' ];
$loadbalancer_tabs [] = 'ltm_pool' ;
}
2015-07-13 20:10:26 +02:00
if ( is_array ( $loadbalancer_tabs )) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'loadbalancer' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'loadbalancer' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-balance-scale fa-lg icon-theme" aria-hidden="true"></i> Load Balancer
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2012-01-18 09:25:16 +00:00
2015-07-13 20:10:26 +02:00
// $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' ;
}
2012-01-12 11:09:45 +00:00
2015-07-13 20:10:26 +02:00
$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' ;
}
2012-01-18 09:25:16 +00:00
2015-07-13 20:10:26 +02:00
$device_routing_count [ 'bgp' ] = dbFetchCell ( 'SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = ?' , array ( $device [ 'device_id' ]));
if ( $device_routing_count [ 'bgp' ]) {
$routing_tabs [] = 'bgp' ;
}
2012-01-12 11:09:45 +00:00
2015-07-13 20:10:26 +02:00
$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' ;
}
2011-09-12 13:53:37 +00:00
2015-07-13 20:10:26 +02:00
$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' ;
}
2011-09-20 09:55:11 +00:00
2015-07-13 20:10:26 +02:00
$device_routing_count [ 'vrf' ] = @ dbFetchCell ( 'SELECT COUNT(*) FROM `vrfs` WHERE `device_id` = ?' , array ( $device [ 'device_id' ]));
if ( $device_routing_count [ 'vrf' ]) {
$routing_tabs [] = 'vrf' ;
}
2011-05-13 08:57:54 +00:00
2017-01-19 18:19:11 +10:00
$device_routing_count [ 'cisco-otv' ] = $component_count [ 'Cisco-OTV' ];
2016-01-21 22:04:20 +10:00
if ( $device_routing_count [ 'cisco-otv' ] > 0 ) {
$routing_tabs [] = 'cisco-otv' ;
}
2015-07-13 20:10:26 +02:00
if ( is_array ( $routing_tabs )) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'routing' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'routing' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-random fa-lg icon-theme" aria-hidden="true"></i> Routing
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2011-05-13 08:57:54 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( 'SELECT 1 FROM `pseudowires` WHERE `device_id` = ?' , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'pseudowires' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'pseudowires' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-arrows-alt fa-lg icon-theme" aria-hidden="true"></i> Pseudowires
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM `links` where `local_device_id`=?" , array ( $device [ 'device_id' ]))) {
2017-10-28 05:59:25 +02:00
echo '<li role="presentation" ' . $select [ 'neighbours' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'neighbours' )) . '">
<i class="fa fa-sitemap fa-lg icon-theme" aria-hidden="true"></i> Neighbours
</a>
</li>' ;
}
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM stp WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'stp' ] . '>
2016-01-03 21:10:35 +01:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'stp' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-sitemap fa-lg icon-theme" aria-hidden="true"></i> STP
2016-01-03 21:10:35 +01:00
</a>
</li>' ;
}
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM `packages` WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'packages' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'packages' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-folder fa-lg icon-theme" aria-hidden="true"></i> Pkgs
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2007-04-03 14:10:23 +00:00
2017-03-22 03:06:46 -05:00
if ( $config [ 'enable_inventory' ]) {
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM `entPhysical` WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'entphysical' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'entphysical' )) . '">
<i class="fa fa-cube fa-lg icon-theme" aria-hidden="true"></i> Inventory
</a>
</li>' ;
2017-10-31 15:35:49 -05:00
} elseif ( @ dbFetchCell ( "SELECT 1 FROM `hrDevice` WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'hrdevice' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'hrdevice' )) . '">
<i class="fa fa-cube fa-lg icon-theme" aria-hidden="true"></i> Inventory
</a>
</li>' ;
}
2015-07-13 20:10:26 +02:00
}
2012-05-02 17:23:27 +00:00
2017-02-16 00:22:31 +01:00
if ( $config [ 'show_services' ]) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'services' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'services' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-cogs fa-lg icon-theme" aria-hidden="true"></i> Services
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2010-02-16 20:45:40 +00:00
2017-10-31 15:35:49 -05:00
if ( dbFetchCell ( "SELECT 1 FROM toner WHERE device_id = ?" , array ( $device [ 'device_id' ]))) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'toner' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'toner' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-print fa-lg icon-theme" aria-hidden="true"></i> Toner
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2011-03-17 00:09:20 +00:00
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'logs' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'logs' )) . '">
<i class="fa fa-sticky-note fa-lg icon-theme" aria-hidden="true"></i> Logs
</a>
</li>' ;
2010-02-16 20:45:40 +00:00
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'alerts' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'alerts' )) . '">
<i class="fa fa-exclamation-circle fa-lg icon-theme" aria-hidden="true"></i> Alerts
</a>
</li>' ;
2011-03-07 16:23:45 +00:00
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'alert-stats' ] . '>
<a href="' . generate_device_url ( $device , array ( 'tab' => 'alert-stats' )) . '">
<i class="fa fa-bar-chart fa-lg icon-theme" aria-hidden="true"></i> Alert Stats
</a>
</li>' ;
2011-03-07 16:23:45 +00:00
2016-02-10 12:17:37 -06:00
if ( is_admin ()) {
2015-07-13 20:10:26 +02:00
if ( ! is_array ( $config [ 'rancid_configs' ])) {
$config [ 'rancid_configs' ] = array ( $config [ 'rancid_configs' ]);
}
2012-05-16 09:26:52 +00:00
2015-07-13 20:10:26 +02:00
foreach ( $config [ 'rancid_configs' ] as $configs ) {
if ( $configs [( strlen ( $configs ) - 1 )] != '/' ) {
$configs .= '/' ;
}
2015-04-12 01:10:48 +02:00
2015-07-13 20:10:26 +02:00
if ( is_file ( $configs . $device [ 'hostname' ])) {
$device_config_file = $configs . $device [ 'hostname' ];
2016-08-18 20:28:22 -05:00
} elseif ( is_file ( $configs . strtok ( $device [ 'hostname' ], '.' ))) { // Strip domain
2016-04-11 08:32:13 +02:00
$device_config_file = $configs . strtok ( $device [ 'hostname' ], '.' );
2016-08-18 20:28:22 -05:00
} else {
2016-04-11 08:32:13 +02:00
if ( ! empty ( $config [ 'mydomain' ])) { // Try with domain name if set
if ( is_file ( $configs . $device [ 'hostname' ] . '.' . $config [ 'mydomain' ])) {
$device_config_file = $configs . $device [ 'hostname' ] . '.' . $config [ 'mydomain' ];
}
}
} // end if
2015-07-13 20:10:26 +02:00
}
2011-03-28 20:29:34 +00:00
2016-11-21 06:45:24 +00:00
if ( $config [ 'oxidized' ][ 'enabled' ] === true && ! in_array ( $device [ 'type' ], $config [ 'oxidized' ][ 'ignore_types' ]) && isset ( $config [ 'oxidized' ][ 'url' ])) {
2015-07-13 20:10:26 +02:00
$device_config_file = true ;
}
}
2011-03-07 16:23:45 +00:00
2015-07-13 20:10:26 +02:00
if ( $device_config_file ) {
2017-10-31 15:35:49 -05:00
if ( ! get_dev_attrib ( $device , 'override_Oxidized_disable' , 'true' )) {
2015-10-12 23:02:29 +02:00
echo '<li class="' . $select [ 'showconfig' ] . '">
<a href="' . generate_device_url ( $device , array ( 'tab' => 'showconfig' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-align-justify fa-lg icon-theme" aria-hidden="true"></i> Config
2015-10-12 23:02:29 +02:00
</a>
</li>' ;
2016-08-18 20:28:22 -05:00
}
2015-07-13 20:10:26 +02:00
}
2011-04-07 19:07:47 +00:00
2015-07-13 20:10:26 +02:00
if ( $config [ 'nfsen_enable' ]) {
if ( ! is_array ( $config [ 'nfsen_rrds' ])) {
$config [ 'nfsen_rrds' ] = array ( $config [ 'nfsen_rrds' ]);
}
foreach ( $config [ 'nfsen_rrds' ] as $nfsenrrds ) {
2016-07-20 12:45:48 +02:00
if ( $nfsenrrds [( strlen ( $nfsenrrds ) - 1 )] != '/' ) {
2015-07-13 20:10:26 +02:00
$nfsenrrds .= '/' ;
}
$nfsensuffix = '' ;
if ( $config [ 'nfsen_suffix' ]) {
$nfsensuffix = $config [ 'nfsen_suffix' ];
}
2017-06-13 23:35:33 +03:00
if ( isset ( $config [ 'nfsen_split_char' ]) && ! empty ( $config [ 'nfsen_split_char' ])) {
$basefilename_underscored = preg_replace ( '/\./' , $config [ 'nfsen_split_char' ], $device [ 'hostname' ]);
} else {
$basefilename_underscored = $device [ 'hostname' ];
}
2016-07-20 12:49:38 +02:00
$nfsen_filename = preg_replace ( '/' . $nfsensuffix . '/' , '' , $basefilename_underscored );
2015-07-13 20:10:26 +02:00
if ( is_file ( $nfsenrrds . $nfsen_filename . '.rrd' )) {
$nfsen_rrd_file = $nfsenrrds . $nfsen_filename . '.rrd' ;
}
}
} //end if
if ( $nfsen_rrd_file ) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'nfsen' ] . '>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'nfsen' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-tint fa-lg icon-theme" aria-hidden="true"></i> Netflow
2015-07-13 20:10:26 +02:00
</a>
</li>' ;
}
2011-04-07 19:07:47 +00:00
2015-10-17 18:49:01 +00:00
if ( can_ping_device ( $attribs ) === true ) {
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'performance' ] . '>
2015-10-17 18:49:01 +00:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'performance' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-line-chart fa-lg icon-theme" aria-hidden="true"></i> Performance
2015-10-17 18:49:01 +00:00
</a>
</li>' ;
}
2011-03-07 16:23:45 +00:00
2017-03-22 03:06:46 -05:00
echo '<li role="presentation" ' . $select [ 'notes' ] . '>
2015-09-17 16:19:48 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'notes' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-file-text-o fa-lg icon-theme" aria-hidden="true"></i> Notes
2015-09-17 16:19:48 +02:00
</a>
</li>' ;
2017-03-22 03:06:46 -05:00
if ( is_mib_poller_enabled ( $device )) {
echo '<li role="presentation" ' . $select [ 'mib' ] . '>
2015-07-20 13:54:26 +10:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'mib' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-file-text-o fa-lg icon-theme" aria-hidden="true"></i> MIB
2015-07-20 13:54:26 +10:00
</a>
</li>' ;
}
2011-03-07 16:23:45 +00:00
2016-02-08 22:55:18 +05:30
echo '<div class="dropdown pull-right">
2017-01-21 13:24:05 +02:00
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-cog fa-lg icon-theme" aria-hidden="true"></i>
2016-02-08 22:51:09 +05:30
<span class="caret"></span></button>
<ul class="dropdown-menu">
2017-01-21 13:24:05 +02:00
<li><a href="https://' . $device [ 'hostname' ] . '" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>
<li><a href="ssh://' . $device [ 'hostname' ] . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>
<li><a href="telnet://' . $device [ 'hostname' ] . '" target="_blank" rel="noopener"><i class="fa fa-terminal fa-lg icon-theme" aria-hidden="true"></i> Telnet</a></li>' ;
2016-08-18 20:28:22 -05:00
if ( is_admin ()) {
echo '<li>
2015-07-13 20:10:26 +02:00
<a href="' . generate_device_url ( $device , array ( 'tab' => 'edit' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-pencil fa-lg icon-theme" aria-hidden="true"></i> Edit </a>
2015-07-13 20:10:26 +02:00
</li>' ;
2016-08-12 09:58:16 -05:00
echo '<li><a href="' . generate_device_url ( $device , array ( 'tab' => 'capture' )) . '">
2017-01-21 13:24:05 +02:00
<i class="fa fa-bug fa-lg icon-theme" aria-hidden="true"></i> Capture
2016-08-12 09:58:16 -05:00
</a></li>' ;
2016-08-18 20:28:22 -05:00
}
2016-02-08 22:51:09 +05:30
echo '</ul>
</div>' ;
2015-07-13 20:10:26 +02:00
echo '</ul>' ;
2017-03-22 03:06:46 -05:00
} //end if device_permitted
2011-03-28 20:29:34 +00:00
2011-03-07 16:23:45 +00:00
2017-03-22 03:06:46 -05:00
// include the tabcontent
echo '<div class="tabcontent">' ;
require 'pages/device/' . filter_var ( basename ( $tab ), FILTER_SANITIZE_URL ) . '.inc.php' ;
echo '</div>' ;
} else {
// no device permissions
require 'includes/error-no-perm.inc.php' ;
}