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 = array ();
$table->data = array ();
$table->headstyle[0] = 'text-align:center;';
$table->width = "100%";
$table->head[0] = '' . __('Pandora FMS Overview') . '';
$table->head_colspan[0] = 4;
// Indicators
$tdata = array();
$stats = reporting_get_stats_indicators($data, 120, 10,false);
$status = '
|
';
echo '
'; //////////////////END OF NEWS BOARD///////////////////////////// } //////////////////LAST ACTIVITY///////////////////////////// // Show last activity from this user echo ' ';
$table = new stdClass();
$table->width = '100%'; //Don't specify px
$table->data = array ();
$table->size = array ();
$table->size[0] = '5%';
$table->size[1] = '15%';
$table->size[2] = '15%';
$table->size[3] = '10%';
$table->size[4] = '25%';
$table->head = array ();
$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 in Pandora FMS console') . '';
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT id_usuario,accion,fecha,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, fecha, \"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, fecha, 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 = array ();
foreach ($sessions as $session) {
$data = array ();
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($session['fecha'], true) . human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen;
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
$data[4] = ' "; // activity
//////////////////END OF LAST ACTIVIYY/////////////////////////////
?>
' . io_safe_output($description) . ' ';
array_push ($table->data, $data);
}
echo "";
html_print_table ($table);
unset($table);
echo " ";
echo " |
' . __('News board') . ' |
---|
'.$article["subject"].' |
' . __('by') . ' ' . $article["author"] . ' ' . ui_print_timestamp ($article["timestamp"], true).' ' . $comparation_suffix . ' |
'; echo nl2br($text); echo ' |