0 && $data['monitor_checks'] > 0) { $data['monitor_health'] = format_numeric((100 - ($data['monitor_not_normal'] / ($data['monitor_checks'] / 100))), 1); } else { $data['monitor_health'] = 100; } if ($data['monitor_not_init'] > 0 && $data['monitor_checks'] > 0) { $data['module_sanity'] = format_numeric((100 - ($data['monitor_not_init'] / ($data['monitor_checks'] / 100))), 1); } else { $data['module_sanity'] = 100; } if (isset($data['alerts'])) { if ($data['monitor_alerts_fired'] > 0 && $data['alerts'] > 0) { $data['alert_level'] = format_numeric((100 - ($data['monitor_alerts_fired'] / ($data['alerts'] / 100))), 1); } else { $data['alert_level'] = 100; } } else { $data['alert_level'] = 100; $data['alerts'] = 0; } $data['monitor_bad'] = ($data['monitor_critical'] + $data['monitor_warning']); if ($data['monitor_bad'] > 0 && $data['monitor_checks'] > 0) { $data['global_health'] = format_numeric((100 - ($data['monitor_bad'] / ($data['monitor_checks'] / 100))), 1); } else { $data['global_health'] = 100; } $data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1); } ?>
class = 'databox'; $table->cellpadding = 4; $table->cellspacing = 4; $table->head = []; $table->data = []; $table->headstyle[0] = 'text-align:center;'; $table->width = '100%'; $table->head[0] = ''.__('%s Overview', get_product_name()).''; $table->head_colspan[0] = 4; // Indicators $tdata = []; $stats = reporting_get_stats_indicators($data, 120, 10, false); $status = ''; foreach ($stats as $stat) { $status .= ''; } $status .= '
'.$stat['title'].''.''.$stat['graph'].'
'; $table->data[0][0] = $status; $table->rowclass[] = ''; $table->data[] = $tdata; // Alerts $tdata = []; $tdata[0] = reporting_get_stats_alerts($data); $table->rowclass[] = ''; $table->data[] = $tdata; // Modules by status $tdata = []; $tdata[0] = reporting_get_stats_modules_status($data, 180, 100); $table->rowclass[] = ''; $table->data[] = $tdata; // Total agents and modules $tdata = []; $tdata[0] = reporting_get_stats_agents_monitors($data); $table->rowclass[] = ''; $table->data[] = $tdata; // Users if (users_is_admin()) { $tdata = []; $tdata[0] = reporting_get_stats_users($data); $table->rowclass[] = ''; $table->data[] = $tdata; } html_print_table($table); unset($table); ?>
'; echo ''; echo ''; if ($config['prominent_time'] == 'timestamp') { $comparation_suffix = ''; } else { $comparation_suffix = __('ago'); } foreach ($news as $article) { $text = io_safe_output($article['text']); echo ''; echo ''; echo ''; } echo '
'.__('News board').'
'.$article['subject'].'
'.__('by').' '.$article['author'].' '.ui_print_timestamp($article['timestamp'], true).' '.$comparation_suffix.'
'; echo nl2br($text); echo '
'; echo ''; // News board echo '

'; // END OF NEWS BOARD///////////////////////////// } // LAST ACTIVITY///////////////////////////// // Show last activity from this user echo '
'; $table = new stdClass(); $table->class = 'databox data'; $table->width = '100%'; // Don't specify px $table->data = []; $table->size = []; $table->size[0] = '5%'; $table->size[1] = '15%'; $table->size[2] = '15%'; $table->size[3] = '10%'; $table->size[4] = '25%'; $table->head = []; $table->head[0] = __('User'); $table->head[1] = __('Action'); $table->head[2] = __('Date'); $table->head[3] = __('Source IP'); $table->head[4] = __('Comments'); $table->title = ''.__('This is your last activity performed on the %s console', get_product_name()).''; switch ($config['dbtype']) { case 'mysql': $sql = sprintf( 'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp FROM tsesion WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config['id_user'] ); break; case 'postgresql': $sql = sprintf( "SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp FROM tsesion WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.") AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config['id_user'] ); break; case 'oracle': $sql = sprintf( "SELECT id_usuario, accion, ip_origen, descripcion, utimestamp FROM tsesion WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.") AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config['id_user'] ); break; } $sessions = db_get_all_rows_sql($sql); if ($sessions === false) { $sessions = []; } foreach ($sessions as $session) { $data = []; switch ($config['dbtype']) { case 'mysql': case 'oracle': $session_id_usuario = $session['id_usuario']; $session_ip_origen = $session['ip_origen']; break; case 'postgresql': $session_id_usuario = $session['id_usuario']; $session_ip_origen = $session['ip_origen']; break; } $data[0] = ''.$session_id_usuario.''; $data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion']; $data[2] = ui_print_help_tip(date($config['date_format'], $session['utimestamp']), true).human_time_comparation($session['utimestamp'], 'tiny'); $data[3] = $session_ip_origen; $description = str_replace([',', ', '], ', ', $session['descripcion']); if (strlen($description) > 100) { $data[4] = '
'.io_safe_output(substr($description, 0, 150).'...').'
'; } else { $data[4] = '
'.io_safe_output($description).'
'; } array_push($table->data, $data); } echo "
"; html_print_table($table); unset($table); echo '
'; echo '
'; // activity // END OF LAST ACTIVIYY///////////////////////////// ?>