Merge branch 'ent-2908-lentitud-vista-tactica-cuando-hay-millones-de-eventos' into 'develop'

Improve performance on tactical view with a lot of events

See merge request artica/pandorafms!1857
This commit is contained in:
vgilc 2018-10-25 10:32:11 +02:00
commit 2b6e8473dc
5 changed files with 194 additions and 193 deletions

View File

@ -38,6 +38,9 @@ $get_event_name = (bool) get_parameter ('get_event_name');
$meta = get_parameter ('meta', 0); $meta = get_parameter ('meta', 0);
$history = get_parameter ('history', 0); $history = get_parameter ('history', 0);
$table_events = get_parameter('table_events', 0); $table_events = get_parameter('table_events', 0);
$total_events = (bool)get_parameter('total_events');
$total_event_graph = (bool)get_parameter('total_event_graph');
$graphic_event_group = (bool)get_parameter('graphic_event_group');
if ($get_event_name) { if ($get_event_name) {
$event_id = get_parameter ('event_id'); $event_id = get_parameter ('event_id');
@ -605,4 +608,37 @@ if ($get_list_events_agents) {
echo $returned_list; echo $returned_list;
return; return;
} }
if ($total_events) {
global $config;
$sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento ';
if ($config['event_view_hr']) {
$sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - ' . $config['event_view_hr'] * SECONDS_1HOUR . ')';
}
$system_events = db_get_value_sql($sql_count_event);
echo $system_events;
return;
}
if ($total_event_graph) {
global $config;
require_once($config["homedir"] . '/include/functions_graph.php');
$prueba = grafico_eventos_total("", 280, 150, false, true);
echo $prueba;
return;
}
if ($graphic_event_group) {
global $config;
require_once($config["homedir"] . '/include/functions_graph.php');
$prueba = grafico_eventos_grupo(280, 150, "", false, true);
echo $prueba;
return;
}
?> ?>

View File

@ -851,21 +851,10 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$filter = '1 = 1'; $filter = '1 = 1';
} }
switch ($config["dbtype"]) { $sql = sprintf ("SELECT DISTINCT tevento.*
case "mysql": FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
case "postgresql": WHERE %s %s
$sql = sprintf ("SELECT DISTINCT tevento.* ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
WHERE %s %s
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
break;
case "oracle":
$sql = sprintf ("SELECT *
FROM tevento
WHERE %s %s AND rownum <= %d
ORDER BY utimestamp DESC", $agent_condition, $filter, $limit);
break;
}
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
@ -997,8 +986,6 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>". $data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>".
agents_get_alias($event["id_agente"]). "</A>"; agents_get_alias($event["id_agente"]). "</A>";
// ui_print_agent_name ($event["id_agente"], true, 25, '', true);
// for System or SNMP generated alerts // for System or SNMP generated alerts
} }
elseif ($event["event_type"] == "system") { elseif ($event["event_type"] == "system") {

View File

@ -2719,10 +2719,8 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
* @param integer width pie graph width * @param integer width pie graph width
* @param integer height pie graph height * @param integer height pie graph height
* @param string url * @param string url
* @param bool if the graph required is or not for metaconsole
* @param bool if the graph required is or not for history table
*/ */
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false, $noWaterMark = true) { function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $noWaterMark = true, $time_limit = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -2752,27 +2750,18 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$url = str_replace( $url = str_replace(
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url); 'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
$event_table = 'tevento';
// Choose the table where search if metaconsole or not $field_extra = '';
if ($meta) { $groupby_extra = '';
if ($history) {
$event_table = 'tmetaconsole_event_history';
}
else {
$event_table = 'tmetaconsole_event';
}
$field_extra = ', agent_name';
$groupby_extra = ', server_id';
}
else {
$event_table = 'tevento';
$field_extra = '';
$groupby_extra = '';
}
// Add tags condition to filter // Add tags condition to filter
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND'); $tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
if ($time_limit && $config['event_view_hr']) {
$tags_condition .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " .
$config['event_view_hr'] * SECONDS_1HOUR . ")";
}
//This will give the distinct id_agente, give the id_grupo that goes //This will give the distinct id_agente, give the id_grupo that goes
//with it and then the number of times it occured. GROUP BY statement //with it and then the number of times it occured. GROUP BY statement
//is required if both DISTINCT() and COUNT() are in the statement //is required if both DISTINCT() and COUNT() are in the statement
@ -2805,13 +2794,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$system_events += $row["count"]; $system_events += $row["count"];
} }
else { else {
if ($meta) { $alias = agents_get_alias($row["id_agente"]);
$name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")"; $name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
}
else {
$alias = agents_get_alias($row["id_agente"]);
$name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
}
$data[$name] = $row["count"]; $data[$name] = $row["count"];
} }
} }
@ -2823,13 +2807,6 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$data[$name] = $system_events; $data[$name] = $system_events;
} }
/*
if ($other_events > 0) {
$name = __('Other')." (".$other_events.")";
$data[$name] = $other_events;
}
*/
// Sort the data // Sort the data
arsort($data); arsort($data);
if ($noWaterMark) { if ($noWaterMark) {
@ -2851,7 +2828,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
* *
* @param string filter Filter for query in DB * @param string filter Filter for query in DB
*/ */
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true) { function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true, $time_limit = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -2860,12 +2837,15 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
// Add tags condition to filter // Add tags condition to filter
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND'); $tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
$filter .= $tags_condition; $filter .= $tags_condition;
if ($time_limit && $config['event_view_hr']) {
$filter .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . $config['event_view_hr'] * SECONDS_1HOUR . ")";
}
$data = array (); $data = array ();
$legend = array (); $legend = array ();
$total = 0; $total = 0;
$where = ''; $where = "WHERE 1=1";
if (!users_is_admin()) { if (!users_is_admin()) {
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')'; $where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
} }
@ -2876,7 +2856,6 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
ON tevento.id_agente = tasg.id_agent ON tevento.id_agente = tasg.id_agent
%s %s %s %s
GROUP BY criticity ORDER BY events DESC", $where , $filter); GROUP BY criticity ORDER BY events DESC", $where , $filter);
$criticities = db_get_all_rows_sql ($sql, false, false); $criticities = db_get_all_rows_sql ($sql, false, false);
if (empty($criticities)) { if (empty($criticities)) {

View File

@ -10065,7 +10065,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
return $data_colors; return $data_colors;
} }
function reporting_get_stats_servers($tiny = true) { function reporting_get_stats_servers() {
global $config; global $config;
$server_performance = servers_get_performance(); $server_performance = servers_get_performance();
@ -10101,21 +10101,20 @@ function reporting_get_stats_servers($tiny = true) {
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
if ($tiny) { if (isset($server_performance ["total_network_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '25px')); $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_remote_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' .
format_numeric($server_performance["network_modules_rate"], 2) .
'</span>';
/* Hello there! :)
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["remote_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>'; $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){ if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){
$tdata[4] = "<div id='agentsmodal' class='publienterprise' title='Community version' style='text-align:left;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>"; $tdata[4] = "<div id='remotemodulesmodal' class='publienterprise' title='Community version' style='text-align:left;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
} }
else{ else{
$tdata[4] = '&nbsp;'; $tdata[4] = '&nbsp;';
@ -10124,127 +10123,84 @@ You can of course remove the warnings, that's why we include the source and do n
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
else {
if (isset($server_performance ["total_network_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' .
format_numeric($server_performance["network_modules_rate"], 2) .
'</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){
$tdata[4] = "<div id='remotemodulesmodal' class='publienterprise' title='Community version' style='text-align:left;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
else{
$tdata[4] = '&nbsp;';
}
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_plugin_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_plugin_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_prediction_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_prediction_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_wmi_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_wmi_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_web_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' .
format_numeric($server_performance ["total_web_modules"]) .
'</span>';
$tdata[2] = '<span class="med_data">' .
format_numeric($server_performance ["web_modules_rate"], 2) .
'</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_plugin_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = '<hr style="border: 0; height: 1px; background: #DDD">'; $tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '25px'));
$table_srv->colspan[count($table_srv->data)][0] = 4; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_plugin_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_prediction_modules"])) {
switch ($config["dbtype"]) {
case "mysql":
$system_events = db_get_value_sql(
'SELECT SQL_NO_CACHE COUNT(id_evento)
FROM tevento');
break;
case "postgresql":
case "oracle":
$system_events = db_get_value_sql(
'SELECT COUNT(id_evento)
FROM tevento');
break;
}
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/lightning_go.png', true, $tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '25px'));
array('title' => __('Total events'), 'width' => '25px')); $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_prediction_modules"]) . '</span>';
$tdata[1] = '<span class="big_data">' .
format_numeric($system_events) . '</span>';
/* Hello there! :) $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_wmi_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_wmi_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
if (isset($server_performance ["total_web_modules"])) {
$tdata = array();
$tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '25px'));
$tdata[1] = '<span class="big_data">' .
format_numeric($server_performance ["total_web_modules"]) .
'</span>';
$tdata[2] = '<span class="med_data">' .
format_numeric($server_performance ["web_modules_rate"], 2) .
'</span>';
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
$tdata = array();
$tdata[0] = '<hr style="border: 0; height: 1px; background: #DDD">';
$table_srv->colspan[count($table_srv->data)][0] = 4;
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
$tdata = array();
$tdata[0] = html_print_image('images/lightning_go.png', true,
array('title' => __('Total events'), 'width' => '25px'));
$tdata[1] = '<span class="big_data" id="total_events">' .
html_print_image('images/spinner.gif',true) . '</span>';
/* Hello there! :)
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/ */
if($system_events > 50000 && !enterprise_installed()){ if($system_events > 50000 && !enterprise_installed()){
$tdata[2] = "<div id='monitoreventsmodal' class='publienterprise' title='Community version' style='text-align:left'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>"; $tdata[2] = "<div id='monitoreventsmodal' class='publienterprise' title='Community version' style='text-align:left'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
} } else {
else{
$tdata[3] = "&nbsp;"; $tdata[3] = "&nbsp;";
}
$table_srv->colspan[count($table_srv->data)][1] = 2;
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
} }
$table_srv->colspan[count($table_srv->data)][1] = 2;
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
$output = '<fieldset class="databox tactical_set"> $output = '<fieldset class="databox tactical_set">
<legend>' . <legend>' .
@ -10252,6 +10208,20 @@ You can of course remove the warnings, that's why we include the source and do n
'</legend>' . '</legend>' .
html_print_table($table_srv, true) . '</fieldset>'; html_print_table($table_srv, true) . '</fieldset>';
$output .= '<script type="text/javascript">';
$output .= '$(document).ready(function () {';
$output .= 'var parameters = {};';
$output .= 'parameters["page"] = "include/ajax/events";';
$output .= 'parameters["total_events"] = 1;';
$output .= '$.ajax({type: "GET",url: "ajax.php",data: parameters,';
$output .= 'success: function(data) {';
$output .= '$("#total_events").text(data);';
$output .= '}';
$output .= '});';
$output .= '});';
$output .= '</script>';
return $output; return $output;
} }

View File

@ -163,7 +163,7 @@ $table->rowclass[] = '';
// Server performance // Server performance
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
if ($is_admin) { if ($is_admin) {
$table->data[4][0] = reporting_get_stats_servers(false); $table->data[4][0] = reporting_get_stats_servers();
$table->rowclass[] = ''; $table->rowclass[] = '';
} }
@ -183,6 +183,11 @@ if (check_acl($config['id_user'],0,'ER')) {
if (!empty($tags_condition)) { if (!empty($tags_condition)) {
$event_filter .= " AND ($tags_condition)"; $event_filter .= " AND ($tags_condition)";
} }
if ($config['event_view_hr']) {
$event_filter .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . $config['event_view_hr'] * SECONDS_1HOUR . ")";
}
$events = events_print_event_table ($event_filter, 10, "100%",true,false,true); $events = events_print_event_table ($event_filter, 10, "100%",true,false,true);
ui_toggle($events, __('Latest events'),false,false); ui_toggle($events, __('Latest events'),false,false);
} }
@ -196,20 +201,44 @@ if ($is_admin) {
} }
$out = '<table cellpadding=0 cellspacing=0 class="databox pies" style="margin-top:15px;" width=100%><tr><td>'; $out = '<table cellpadding=0 cellspacing=0 class="databox pies" style="margin-top:15px;" width=100%><tr><td>';
$out .= '<fieldset class="databox tactical_set"> $out .= '<fieldset class="databox tactical_set" id="total_event_graph">
<legend>' . <legend>' .
__('Event graph') . __('Event graph') .
'</legend>' . '</legend>' .
grafico_eventos_total("", 280, 150, false) . '</fieldset>'; html_print_image('images/spinner.gif',true,array('id' => 'spinner_total_event_graph')) . '</fieldset>';
$out .="</td><td>"; $out .="</td><td>";
$out .= '<fieldset class="databox tactical_set"> $out .= '<fieldset class="databox tactical_set" id="graphic_event_group">
<legend>' . <legend>' .
__('Event graph by agent') . __('Event graph by agent') .
'</legend>' . '</legend>' .
grafico_eventos_grupo(280, 150, "", false, false, false) . '</fieldset>'; html_print_image('images/spinner.gif', true, array('id' => 'spinner_graphic_event_group')) . '</fieldset>';
$out .= '</td></tr></table>'; $out .= '</td></tr></table>';
echo $out; echo $out;
echo '</td>'; echo '</td>';
echo '</tr></table>'; echo '</tr></table>';
?> ?>
<script type="text/javascript">
$(document).ready(function () {
var parameters = {};
parameters["page"] = "include/ajax/events";
parameters["total_event_graph"] = 1;
$.ajax({type: "GET",url: "ajax.php",data: parameters,
success: function(data) {
$("#spinner_total_event_graph").hide();
$("#total_event_graph").append(data);
}
});
delete parameters["total_event_graph"];
parameters["graphic_event_group"] = 1;
$.ajax({type: "GET",url: "ajax.php",data: parameters,
success: function(data) {
$("#spinner_graphic_event_group").hide();
$("#graphic_event_group").append(data);
}
});
});
</script>