2010-05-03 16:20:32 +00:00
< ? php print_optionbar_start ();
if ( ! $_GET [ 'opta' ]) { $_GET [ 'opta' ] = " basic " ; }
echo ( " <a href=' " . $config [ 'base_url' ] . " /services/basic/'>Basic</a> | " );
echo ( " <a href=' " . $config [ 'base_url' ] . " /services/details/'>Details</a> " );
print_optionbar_end ();
2007-06-24 14:56:47 +00:00
if ( $_GET [ 'status' ] == '0' ) { $where = " AND service_status = '0' " ; } else { unset ( $where ); }
2007-04-03 14:10:23 +00:00
echo ( " <div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%> " );
//echo("<tr class=interface-desc bgcolor='#e5e5e5'><td>Device</td><td>Service</td><td>Status</td><td>Changed</td><td>Checked</td><td>Message</td></tr>");
2010-03-17 15:25:33 +00:00
if ( $_SESSION [ 'userlevel' ] >= '5' ) {
2010-02-21 19:32:08 +00:00
$host_sql = " SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY D.hostname ORDER BY D.hostname " ;
2007-06-24 14:56:47 +00:00
} else {
2010-02-21 19:32:08 +00:00
$host_sql = " SELECT * FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.device_id AND D.device_id = P.device_id AND P.user_id = ' " . $_SESSION [ 'user_id' ] . " ' $where GROUP BY D.hostname ORDER BY D.hostname " ;
2007-06-24 14:56:47 +00:00
}
2007-04-03 14:10:23 +00:00
$host_query = mysql_query ( $host_sql );
while ( $host_data = mysql_fetch_array ( $host_query )) {
2007-04-08 18:09:21 +00:00
$device_id = $host_data [ 'device_id' ];
$device_hostname = $host_data [ 'hostname' ];
2010-02-21 19:32:08 +00:00
$service_query = mysql_query ( " SELECT * FROM `services` WHERE `device_id` = ' " . $host_data [ 'device_id' ] . " ' $where " );
2010-05-03 16:20:32 +00:00
while ( $service = mysql_fetch_array ( $service_query ))
{
2007-04-03 14:10:23 +00:00
include ( " includes/print-service.inc " );
2010-05-03 16:20:32 +00:00
# $samehost = 1;
if ( $_GET [ 'opta' ] == " details " )
{
$graph_array [ 'height' ] = " 100 " ;
$graph_array [ 'width' ] = " 215 " ;
$graph_array [ 'to' ] = $now ;
$graph_array [ 'id' ] = $service [ 'service_id' ];
2010-08-10 12:16:00 +00:00
$graph_array [ 'type' ] = " service_availability " ;
2010-05-03 16:20:32 +00:00
$periods = array ( 'day' , 'week' , 'month' , 'year' );
2010-06-20 19:20:56 +00:00
echo ( '<tr style="background-color: ' . $bg . '; padding: 5px;"><td colspan=6>' );
2010-05-03 16:20:32 +00:00
foreach ( $periods as $period ) {
$graph_array [ 'from' ] = $$period ;
$graph_array_zoom = $graph_array ; $graph_array_zoom [ 'height' ] = " 150 " ; $graph_array_zoom [ 'width' ] = " 400 " ;
echo ( overlib_link ( $_SERVER [ 'REQUEST_URI' ], generate_graph_tag ( $graph_array ), generate_graph_tag ( $graph_array_zoom ), NULL ));
}
echo ( " </td></tr> " );
}
2007-04-03 14:10:23 +00:00
}
unset ( $samehost );
}
echo ( " </table></div> " );
?>