2007-04-03 14:10:23 +00:00
< ?
2008-07-22 08:24:34 +00:00
if ( $_GET [ 'id' ]) { $_GET [ 'id' ] = mres ( $_GET [ 'id' ]); }
2007-11-21 14:26:24 +00:00
if ( devicepermitted ( $_GET [ 'id' ])) {
2007-04-09 16:39:23 +00:00
$selected [ 'iface' ] = " selected " ;
2007-04-03 14:10:23 +00:00
2007-04-09 16:39:23 +00:00
if ( ! $_GET [ 'section' ]) {
2008-11-27 12:36:37 +00:00
$_GET [ 'section' ] = " overview " ;
2007-04-03 14:10:23 +00:00
}
2008-07-22 08:24:34 +00:00
$section = mres ( $_GET [ 'section' ]);
$section = str_replace ( " . " , " " , $section );
2007-06-06 16:43:08 +00:00
$select [ $section ] = " selected " ;
2007-04-03 14:10:23 +00:00
2007-04-09 16:39:23 +00:00
$device_query = mysql_query ( " SELECT * FROM `devices` WHERE `device_id` = ' " . $_GET [ 'id' ] . " ' " );
2007-04-03 14:10:23 +00:00
while ( $device = mysql_fetch_array ( $device_query )) {
2007-04-09 16:39:23 +00:00
echo ( " <table cellpadding=7 cellspacing=0 class=devicetable width=100%> " );
include ( " includes/device-header.inc " );
echo ( " </table><br /> " );
2007-04-03 14:10:23 +00:00
echo ( " <div class=mainpane> " );
echo ( "
< ul id = 'maintab' class = 'shadetabs' >
2009-05-11 13:43:59 +00:00
" );
#echo("
#<ul id='maintab' class='shadetabs'>
#<li class=" . $select['overview'] . ">
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/overview/'>
# <img src='images/16/server_lightning.png' align=absmiddle border=0> Overview
# </a>
#</li>");
2007-04-15 14:38:26 +00:00
2009-03-11 15:30:01 +00:00
echo ( " <li class= " . $select [ 'graphs' ] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/graphs/' >
2009-03-11 15:30:01 +00:00
< img src = 'images/16/server_chart.png' align = absmiddle border = 0 > Graphs
</ a >
</ li >
" );
2009-05-28 13:03:52 +00:00
$health = mysql_result ( mysql_query ( " select count(*) from storage WHERE host_id = ' " . $device [ 'device_id' ] . " ' " ), 0 ) +
mysql_result ( mysql_query ( " select count(temp_id) from temperature WHERE temp_host = ' " . $device [ 'device_id' ] . " ' " ), 0 ) +
2009-04-23 21:13:56 +00:00
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 );
if ( $health ) {
echo ( "
< li class = " . $select['health'] . " >
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/health/' >
< img src = 'images/16/chart_curve.png' align = absmiddle border = 0 > Health
</ a >
</ li >
" );
}
2009-05-06 16:50:51 +00:00
$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 ( "
< li class = " . $select['ciscosensors'] . " >
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/ciscosensors/' >
< img src = 'images/16/contrast.png' align = absmiddle border = 0 > Sensors
</ a >
</ li >
" );
}
2009-04-23 21:13:56 +00:00
if ( is_dir ( $config [ 'collectd_dir' ] . " / " . $device [ 'hostname' ] . " / " )) {
echo ( "
< li class = " . $select['collectd'] . " >
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/collectd/' >
< img src = 'images/16/chart_line.png' align = absmiddle border = 0 > CollectD
</ a >
</ li >
" );
}
if ( @ mysql_result ( mysql_query ( " select count(interface_id) from interfaces WHERE device_id = ' " . $device [ 'device_id' ] . " ' " ), 0 ) > '0' ) {
echo ( "
< li class = " . $select['ports'] . " >
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/ports/".$config[' ports_page_default ']."' >
< img src = 'images/16/connect.png' align = absmiddle border = 0 > Ports
</ a >
</ li > " );
}
2007-04-15 14:38:26 +00:00
if ( @ mysql_result ( mysql_query ( " select count(vlan_id) from vlans WHERE device_id = ' " . $device [ 'device_id' ] . " ' " ), 0 ) > '0' ) {
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['vlans'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/vlans/' >
2009-03-20 13:25:19 +00:00
< img src = 'images/16/vlans.png' align = 'absmiddle' border = '0' > VLANs
2007-04-15 14:38:26 +00:00
</ a >
</ li > " );
}
2008-10-28 22:06:00 +00:00
if ( @ mysql_result ( mysql_query ( " select count(*) from vrfs WHERE device_id = ' " . $device [ 'device_id' ] . " ' " ), 0 ) > '0' ) {
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['vrfs'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/vrfs/' >
2008-10-28 22:06:00 +00:00
< img src = 'images/16/layers.png' align = absmiddle border = 0 > VRFs
</ a >
</ li > " );
}
2008-03-18 13:35:17 +00:00
if ( $config [ 'enable_bgp' ] && $device [ 'bgpLocalAs' ]) {
2008-03-15 17:58:15 +00:00
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['bgp'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/bgp/' >
2008-03-15 17:58:15 +00:00
< img src = 'images/16/link.png' align = absmiddle border = 0 > BGP
</ a >
</ li > " );
}
2009-04-23 21:13:56 +00:00
if ( @ mysql_result ( mysql_query ( " SELECT count(*) FROM nagios_hosts WHERE address = ' " . $device [ 'hostname' ] . " ' " , $nagios_link ), 0 ) > '0' ) {
2007-04-03 14:10:23 +00:00
echo ( "
2009-04-23 21:13:56 +00:00
< li class = " . $select['nagios'] . " >
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/nagios/' >
< img src = 'images/16/transmit_blue.png' align = absmiddle border = 0 > Nagios
2007-04-03 14:10:23 +00:00
</ a >
</ li > " );
}
2007-04-15 14:38:26 +00:00
2009-04-23 21:13:56 +00:00
if ( $_SESSION [ userlevel ] >= " 5 " && mysql_result ( mysql_query ( " SELECT count(*) FROM links AS L, interfaces AS I WHERE I.device_id = ' " . $device [ 'device_id' ] . " ' AND I.interface_id = L.src_if " ), 0 )) {
2009-03-11 14:46:55 +00:00
echo ( "
< li class = " . $select['map'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/map/' >
2009-03-11 15:30:01 +00:00
< img src = 'images/16/chart_organisation.png' align = absmiddle border = 0 > Map
2009-03-11 14:46:55 +00:00
</ a >
</ li >
" );
}
2009-01-09 15:01:36 +00:00
if ( $config [ 'enable_inventory' ] && @ mysql_result ( mysql_query ( " SELECT * FROM `entPhysical` WHERE device_id = ' " . $_GET [ 'id' ] . " ' " ), 0 ) > '0' ) {
2007-11-21 14:26:24 +00:00
2008-11-27 12:36:37 +00:00
echo ( " <li class= " . $select [ 'entphysical' ] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/entphysical/' >
2007-11-21 14:26:24 +00:00
< img src = 'images/16/bricks.png' align = absmiddle border = 0 > Inventory
</ a >
</ li >
" );
}
2009-05-11 13:43:59 +00:00
#if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
# echo("
#<li class=" . $select['storage'] . ">
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/storage/'>
# <img src='images/16/database.png' align=absmiddle border=0> Storage
# </a>
#</li>
#");
#}
2007-11-21 14:26:24 +00:00
2007-04-08 14:34:19 +00:00
if ( mysql_result ( mysql_query ( " select count(service_id) from services WHERE service_host = ' " . $device [ 'device_id' ] . " ' " ), 0 ) > '0' ) {
2007-04-03 14:10:23 +00:00
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['srv'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/srv/' >
2007-06-06 16:43:08 +00:00
< img src = 'images/16/server_cog.png' align = absmiddle border = 0 > Services
2007-04-03 14:10:23 +00:00
</ a >
</ li >
" );
}
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['events'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/events/' >
2008-11-05 15:24:44 +00:00
< img src = 'images/16/report_magnify.png' align = absmiddle border = 0 > Events
2007-04-03 14:10:23 +00:00
</ a >
</ li > " );
2008-03-19 19:15:57 +00:00
if ( $config [ 'enable_syslog' ]) { echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['syslog'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/syslog/' >
2007-04-03 14:10:23 +00:00
< img src = 'images/16/printer.png' align = absmiddle border = 0 > Syslog
</ a >
</ li >
2008-03-19 19:15:57 +00:00
" ); }
2007-04-03 14:10:23 +00:00
2009-02-04 16:18:11 +00:00
if ( $_SESSION [ userlevel ] >= " 5 " && is_file ( $config [ 'rancid_configs' ] . $device [ 'hostname' ])) {
echo ( "
< li class = " . $select['showconfig'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/showconfig/' >
2009-02-04 16:18:11 +00:00
< img src = 'images/16/page_white_text.png' align = absmiddle border = 0 > Config
</ a >
</ li >
" );
}
2007-11-21 14:26:24 +00:00
if ( $_SESSION [ userlevel ] >= " 5 " ) {
2007-04-03 14:10:23 +00:00
echo ( "
2008-11-27 12:36:37 +00:00
< li class = " . $select['edit'] . " >
2009-03-23 17:32:25 +00:00
< a href = '".$config[' base_url ']."/device/" . $device[' device_id '] . "/edit/' >
2007-06-06 16:43:08 +00:00
< img src = 'images/16/server_edit.png' align = absmiddle border = 0 > Settings
2007-04-03 14:10:23 +00:00
</ a >
</ li >
" );
}
echo ( " </ul> " );
echo ( "
< div class = contentstyle > " );
2008-11-27 12:36:37 +00:00
include ( " pages/device/ " . mres ( $section ) . " .inc.php " );
2007-04-03 14:10:23 +00:00
2009-02-06 14:53:33 +00:00
2007-04-03 14:10:23 +00:00
echo ( " </div>
" );
}
2007-11-21 14:26:24 +00:00
} else { echo ( " <span class=alert>You do not have the necessary access permissions to view this device.</span> " ); }
2007-04-03 14:10:23 +00:00
?>