";
$nick = $_SESSION['id_usuario'];
echo "
" . __('Welcome to Pandora FMS Web Console') . "
";
echo "";
echo __('This is the Web Management System for Pandora FMS. From here you can manage its agents, alerts and incidents. Session is open while activity exists.');
echo "
";
// Private messages pending to read !
$sql = sprintf ("SELECT COUNT(id_mensaje) AS count FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';",$nick);
$resultado = get_db_sql ($sql);
if ($resultado != 0) {
echo "';
}
echo "";
echo "";
// Site news !
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo '' . __('Site news') . '';
$sql_news = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3";
if ($result_news = mysql_query ($sql_news)){
echo '';
while ($row = mysql_fetch_array ($result_news)) {
echo '';
echo "".$row["subject"]."";
echo " | ".__('by')." ".$row["author"]. " ".__('At')." ".$row["timestamp"]."";
echo ' | ';
echo clean_output_breaks($row["text"]);
}
echo " | ";
}
echo " | ";
// Site stats
// Summary
// ~~~~~~~~~~~~~~~
$data = general_stats ($config['id_user'],0);
$monitor_checks = $data[0];
$monitor_ok = $data[1];
$monitor_bad = $data[2];
$monitor_unknown = $data[3];
$monitor_alert = $data[4];
$total_agents = $data[5];
$data_checks = $data[6];
$data_unknown = $data[7];
$data_alert = $data[8];
$data_alert_total = $data[9];
$monitor_alert_total = $data[10];
$data_not_init = $data[11];
$monitor_not_init = $data[12];
// Calculate global indicators
$total_checks = $data_checks + $monitor_checks;
$notinit_percentage = (($data_not_init + $monitor_not_init) / ($total_checks / 100));
$module_sanity = format_numeric (100 - $notinit_percentage);
$total_alerts = $data_alert + $monitor_alert;
$total_fired_alerts = $monitor_alert_total+$data_alert_total;
if ( $total_fired_alerts > 0) {
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
} else {
$alert_level = 100;
}
if ($monitor_checks > 0){
$monitor_health = format_numeric (100 - (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)), 1);
} else {
$monitor_health = 100;
}
if ($data_checks > 0) {
$data_health = format_numeric ((($data_checks - ($data_unknown + $data_alert)) / $data_checks ) * 100, 1);
} else {
$data_health = 100;
}
if ($data_checks != 0 || $data_checks != 0) {
$global_health = format_numeric ((($data_health * $data_checks) + ($monitor_health * $monitor_checks)) / $total_checks);
} else {
$global_health = 100;
}
if ($global_health < 0)
$global_health;
echo "";
echo "".__('Monitor health')."";
echo " | ";
echo " | ".__('Data health')."";
echo " | ";
echo " | ".__('Global health')."";
echo " | ";
echo " | ".__('Module sanity')."";
echo " | ";
echo " | ".__('Alert level')."";
echo " | ";
echo " | ";
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";
$users_defined = get_db_sql ($query1);
echo "";
echo "".__('Pandora FMS Overview')." | ";
echo ""."Total agents"." | ";
echo "".$total_agents." | ";
echo " "."Total checks"." | ";
echo "".$total_checks." | ";
echo " "."Monitor BAD"." | ";
echo "";
if ($monitor_bad > 0)
echo $monitor_bad;
else
echo "-";
echo " | "."Alerts defined"." | ";
echo "".$total_alerts." | ";
echo " "."Total users"." | ";
echo "".$users_defined." | ";
echo " ";
echo " |
";
echo "";
// Show last activity from this user
echo "
" . __('This is your last activity in Pandora FMS console') . "
";
$color = 1;
$table->width = '700px';
$table->data = array ();
$table->size = array ();
$table->size[2] = '130px';
$table->size[4] = '200px';
$table->head = array ();
$table->head[0] = __('user');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$sql = sprintf ("SELECT ID_usuario,accion,fecha,IP_origen,descripcion
FROM `tsesion`
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
AND `ID_usuario` = '%s' ORDER BY `fecha` DESC LIMIT 5",
$nick);
$sessions = get_db_all_rows_sql ($sql);
if ($sessions === false)
$sessions = array ();
foreach ($sessions as $session) {
$data = array ();
$data[0] = ''.$session['ID_usuario'].'';
$data[1] = $session['accion'];
$data[2] = $session['fecha'];
$data[3] = $session['IP_origen'];
$data[4] = $session['descripcion'];
array_push ($table->data, $data);
}
print_table ($table);
echo ""; // activity
echo ''; // class "jus"
?>