Id()] = $S; } session_start(); foreach ( array('ServerFilter','StorageFilter') as $var ) { if ( isset( $_REQUEST[$var] ) ) { if ( $_REQUEST[$var] != '' ) { $_SESSION[$var] = $_REQUEST[$var]; } else { unset( $_SESSION[$var] ); } } else if ( isset( $_COOKIE[$var] ) ) { if ( $_COOKIE[$var] != '' ) { $_SESSION[$var] = $_COOKIE[$var]; } else { unset($_SESSION[$var]); } } } session_write_close(); $storage_areas = Storage::find_all(); $StorageById = array(); foreach ( $storage_areas as $S ) { $StorageById[$S->Id()] = $S; } $show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0; if ( $running == null ) $running = daemonCheck(); $eventCounts = array( array( 'title' => translate('Events'), 'filter' => array( 'Query' => array ( 'terms' => array() ) ), 'total' => 0, ), array( 'title' => translate('Hour'), 'filter' => array( 'Query' => array( 'terms' => array( array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 hour' ), ) ) ), 'total' => 0, ), array( 'title' => translate('Day'), 'filter' => array( 'Query' => array( 'terms' => array( array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 day' ), ) ) ), 'total' => 0, ), array( 'title' => translate('Week'), 'filter' => array( 'Query' => array( 'terms' => array( array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-7 day' ), ) ) ), 'total' => 0, ), array( 'title' => translate('Month'), 'filter' => array( 'Query' => array( 'terms' => array( array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 month' ), ) ) ), 'total' => 0, ), array( 'title' => translate('Archived'), 'filter' => array( 'Query' => array( 'terms' => array( array( 'attr' => 'Archived', 'op' => '=', 'val' => '1' ), ) ) ), 'total' => 0, ), ); $navbar = getNavBarHTML(); noCacheHeaders(); $eventsWindow = 'zm'.ucfirst(ZM_WEB_EVENTS_VIEW); $left_columns = 3; if ( count($servers) ) $left_columns += 1; if ( ZM_WEB_ID_ON_CONSOLE ) $left_columns += 1; if ( $show_storage_areas ) $left_columns += 1; xhtmlHeaders( __FILE__, translate('Console') ); ?>
'All'); if ( $monitor_id ) { $found_selected_monitor = false; for ( $i = 0; $i < count($monitors); $i++ ) { if ( !visibleMonitor( $monitors[$i]['Id'] ) ) { continue; } $monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name']; if ( $monitors[$i]['Id'] == $monitor_id ) { $found_selected_monitor = true; } } if ( ! $found_selected_monitor ) { $monitor_id = ''; } } for ( $i = 0; $i < count($monitors); $i++ ) { if ( !visibleMonitor( $monitors[$i]['Id'] ) ) { continue; } $monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name']; if ( $monitor_id and ( $monitors[$i]['Id'] != $monitor_id ) ) { continue; } if ( $monitors[$i]['Function'] != 'None' ) { $scaleWidth = reScale( $monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); $scaleHeight = reScale( $monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth; if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight; } $displayMonitors[] = $monitors[$i]; } echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') ); $cycleWidth = $maxWidth; $cycleHeight = $maxHeight; $zoneCount = 0; for( $i = 0; $i < count($displayMonitors); $i += 1 ) { $monitor = $displayMonitors[$i]; $monitor['zmc'] = zmcStatus( $monitor ); $monitor['zma'] = zmaStatus( $monitor ); $monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) ); $counts = array(); for ( $j = 0; $j < count($eventCounts); $j += 1 ) { $filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['Query']['terms']), array( 'cnj' => 'and', 'attr' => 'MonitorId', 'op' => '=', 'val' => $monitor['Id'] ) ); parseFilter( $filter ); $counts[] = 'count(if(1'.$filter['sql'].",1,NULL)) AS EventCount$j, SUM(if(1".$filter['sql'].",DiskSpace,NULL)) As DiskSpace$j"; $monitor['eventCounts'][$j]['filter'] = $filter; } $sql = 'SELECT '.join($counts,', ').' FROM Events as E where MonitorId = ?'; $counts = dbFetchOne( $sql, NULL, array($monitor['Id']) ); if ( $counts ) $displayMonitors[$i] = $monitor = array_merge( $monitor, $counts ); for ( $j = 0; $j < count($eventCounts); $j += 1 ) { $eventCounts[$j]['total'] += $monitor['EventCount'.$j]; } $zoneCount += $monitor['ZoneCount']; } ?> 0 ) { ?> 'All')+$ServersById, (isset($_SESSION['ServerFilter'])?$_SESSION['ServerFilter']:''), array('onchange'=>'changeFilter(this);') ); ?> 0 ) { ?> 'All')+$StorageById, (isset($_SESSION['StorageFilter'])?$_SESSION['StorageFilter']:''), array('onchange'=>'changeFilter(this);') ); ?>
'. makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', ''.$source.'', canEdit( 'Monitors' ) ).''; if ( $show_storage_areas ) { ?>
disabled="disabled"/>
'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'', canEdit( 'Monitors' ) ) ?> Name(); ?> Name(); } ?> ' . human_filesize($monitor['DiskSpace'.$i]), canView( 'Events' ) ) ?> disabled="disabled"/>