';
$data = reporting_get_group_stats ();
///////////////
// Overview
///////////////
// Link URLS
$urls = array();
$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
$urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1";
$urls['monitor_critical'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2";
$urls['monitor_warning'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1";
$urls['monitor_ok'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0";
$urls['monitor_unknown'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3";
$urls['monitor_not_init'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=5";
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
if (check_acl ($config['id_user'], 0, "UM")) {
$urls['defined_users'] = "index.php?sec=gusuarios&sec2=godmode/users/user_list";
}
else{
$urls['defined_users'] = 'javascript:';
}
// Transparent table as template to build subtables
$table_transparent->class = "none";
$table_transparent->cellpadding = 0;
$table_transparent->cellspacing = 0;
$table_transparent->head = array ();
$table_transparent->data = array ();
$table_transparent->style[0] = $table_transparent->style[1] = $table_transparent->style[2] = $table_transparent->style[3] = 'text-align:center; width: 25%;';
$table_transparent->width = "100%";
// Indicators table
$table_ind = clone $table_transparent;
$tdata[0] = '
' .
__('Monitor health') . ui_print_help_tip (sprintf(__('%d Not OK monitors'), $data["monitor_not_normal"]), true) .
' ' .
progress_bar($data["monitor_health"], 280, 20, $data["monitor_health"].'% '.__('of monitors up'), 0) . ' ';
$table_ind->rowclass[] = '';
$table_ind->data[] = $tdata;
$tdata[0] = '
' .
__('Module sanity') . ui_print_help_tip (sprintf(__('%d Not inited monitors'), $data["monitor_not_init"]), true) .
' ' .
progress_bar($data["module_sanity"], 280, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0) . ' ';
$table_ind->rowclass[] = '';
$table_ind->data[] = $tdata;
$tdata[0] = '
' .
__('Alert level') . ui_print_help_tip (sprintf(__('%d Fired alerts'), $data["monitor_alerts_fired"]), true) .
' ' .
progress_bar($data["alert_level"], 280, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0) . ' ';
$table_ind->rowclass[] = '';
$table_ind->data[] = $tdata;
// Agents and modules table
$table_am = clone $table_transparent;
$tdata = array();
$tdata[0] = html_print_image('images/bricks.png', true, array('title' => __('Total agents'), 'width' => '20px'));
$tdata[1] = $data["total_agents"] == 0 ? '-' : $data["total_agents"];
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = html_print_image('images/brick.png', true, array('title' => __('Monitor checks'), 'width' => '20px'));
$tdata[3] = $data["monitor_checks"] == 0 ? '-' : $data["monitor_checks"];
$tdata[3] = '
' . $tdata[3] . ' ';
$table_am->rowclass[] = '';
$table_am->data[] = $tdata;
// Modules by status table
$table_mbs = clone $table_transparent;
$tdata = array();
$tdata[0] = html_print_image('images/status_sets/default/agent_critical_ball.png', true, array('title' => __('Monitor critical'), 'width' => '20px'));
$tdata[1] = $data["monitor_critical"] == 0 ? '-' : $data["monitor_critical"];
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = html_print_image('images/status_sets/default/agent_warning_ball.png', true, array('title' => __('Monitor warning'), 'width' => '20px'));
$tdata[3] = $data["monitor_warning"] == 0 ? '-' : $data["monitor_warning"];
$tdata[3] = '
' . $tdata[3] . ' ';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
$tdata = array();
$tdata[0] = html_print_image('images/status_sets/default/agent_ok_ball.png', true, array('title' => __('Monitor normal'), 'width' => '20px'));
$tdata[1] = $data["monitor_ok"] == 0 ? '-' : $data["monitor_ok"];
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = html_print_image('images/status_sets/default/agent_no_monitors_ball.png', true, array('title' => __('Monitor unknown'), 'width' => '20px'));
$tdata[3] = $data["monitor_unknown"] == 0 ? '-' : $data["monitor_unknown"];
$tdata[3] = '
' . $tdata[3] . ' ';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
$tdata = array();
$tdata[0] = html_print_image('images/status_sets/default/agent_no_data_ball.png', true, array('title' => __('Monitor not init'), 'width' => '20px'));
$tdata[1] = $data["monitor_not_init"] == 0 ? '-' : $data["monitor_not_init"];
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = $tdata[3] = '';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
if($data["monitor_checks"] > 0) {
$tdata = array();
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '
' . graph_agent_status (false, 250, 150, true, true) . '
';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
}
// Alerts table
$table_al = clone $table_transparent;
$tdata = array();
$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px'));
$tdata[1] = $data["monitor_alerts"] == 0 ? '-' : $data["monitor_alerts"];
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px'));
$tdata[3] = $data["monitor_alerts_fired"] == 0 ? '-' : $data["monitor_alerts_fired"];
$tdata[3] = '
' . $tdata[3] . ' ';
$table_al->rowclass[] = '';
$table_al->data[] = $tdata;
// Users table
$table_us = clone $table_transparent;
$tdata = array();
$tdata[0] = html_print_image('images/group.png', true, array('title' => __('Defined users'), 'width' => '20px'));
$tdata[1] = count (get_users ());
$tdata[1] = '
' . $tdata[1] . ' ';
$tdata[2] = $tdata[3] = ' ';
$table_us->rowclass[] = '';
$table_us->data[] = $tdata;
// Overview table build
$table->class = "databox";
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = array ();
$table->data = array ();
$table->style[0] = 'text-align:center;';
$table->width = "100%";
$table->head[0] = __('Pandora FMS Overview');
$table->head_colspan[0] = 4;
// Indicators
$tdata = array();
$tdata[0] = html_print_table($table_ind, true);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Total agents and modules
$tdata = array();
$tdata[0] = '
' .
__('Total agents and monitors') .
' ' .
html_print_table($table_am, true) . ' ';
$table->rowclass[] = '';
$table->data[] = $tdata;
// Modules by status
$tdata = array();
$tdata[0] = '
' .
__('Monitors by status') .
' ' .
html_print_table($table_mbs, true) . ' ';
$table->rowclass[] = '';
$table->data[] = $tdata;
// Alerts
$tdata = array();
$tdata[0] = '
' .
__('Defined and fired alerts') .
' ' .
html_print_table($table_al, true) . ' ';
$table->rowclass[] = '';
$table->data[] = $tdata;
// Users
$tdata = array();
$tdata[0] = '
' .
__('Users') .
' ' .
html_print_table($table_us, true) . ' ';
$table->rowclass[] = '';
$table->data[] = $tdata;
html_print_table($table);
unset($table);
echo "
";
echo "';
// Show last activity from this user
echo "
" . __('This is your last activity in Pandora FMS console') . " ";
$table->width = '98%'; //Don't specify px
$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');
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
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
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
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] = $session['accion'];
$data[2] = $session['fecha'];
$data[3] = $session_ip_origen;
$data[4] = io_safe_output ($session['descripcion']);
array_push ($table->data, $data);
}
echo "
";
html_print_table ($table);
echo "
";
echo "
"; // activity
?>