2013-02-05 Miguel de Dios <miguel.dedios@artica.es>
* ajax.php: added the autologin hash for some ajax call of user without login (but with hash autologin). * godmode/reporting/reporting_builder.list_items.php, include/db/mysql.php: cleaned source code style. * include/functions_reporting.php, include/functions_events.php, operation/reporting/reporting_xml.php: optimized the get by steps the group events. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7588 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
827cd23557
commit
6ce7910dc8
|
@ -1,3 +1,15 @@
|
||||||
|
2013-02-05 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* ajax.php: added the autologin hash for some ajax call of user
|
||||||
|
without login (but with hash autologin).
|
||||||
|
|
||||||
|
* godmode/reporting/reporting_builder.list_items.php,
|
||||||
|
include/db/mysql.php: cleaned source code style.
|
||||||
|
|
||||||
|
* include/functions_reporting.php, include/functions_events.php,
|
||||||
|
operation/reporting/reporting_xml.php: optimized the get by steps
|
||||||
|
the group events.
|
||||||
|
|
||||||
2013-02-05 Sancho Lerena <slerena@artica.es>
|
2013-02-05 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* operation/menu.php: Fixed duplicity in SNMP trap menu. SNMP
|
* operation/menu.php: Fixed duplicity in SNMP trap menu. SNMP
|
||||||
|
|
|
@ -26,9 +26,30 @@ require_once ('include/auth/mysql.php');
|
||||||
// Real start
|
// Real start
|
||||||
session_start ();
|
session_start ();
|
||||||
|
|
||||||
|
// Hash login process
|
||||||
|
if (isset ($_GET["loginhash"])) {
|
||||||
|
|
||||||
|
$loginhash_data = get_parameter("loginhash_data", "");
|
||||||
|
$loginhash_user = get_parameter("loginhash_user", "");
|
||||||
|
|
||||||
|
if ($config["loginhash_pwd"] != ""
|
||||||
|
&& $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) {
|
||||||
|
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||||
|
$_SESSION['id_usuario'] = $loginhash_user;
|
||||||
|
$config["id_user"] = $loginhash_user;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
require_once ('general/login_page.php');
|
||||||
|
db_pandora_audit("Logon Failed (loginhash", "", "system");
|
||||||
|
while (@ob_end_flush ());
|
||||||
|
exit ("</html>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check user
|
// Check user
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
|
|
||||||
define ('AJAX', true);
|
define ('AJAX', true);
|
||||||
|
|
||||||
/* Enterprise support */
|
/* Enterprise support */
|
||||||
|
|
|
@ -228,6 +228,7 @@ $table = null;
|
||||||
|
|
||||||
$table->style[0] = 'text-align: right;';
|
$table->style[0] = 'text-align: right;';
|
||||||
|
|
||||||
|
|
||||||
if ($items) {
|
if ($items) {
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ function mysql_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
|
||||||
*/
|
*/
|
||||||
function mysql_escape_string_sql($string) {
|
function mysql_escape_string_sql($string) {
|
||||||
$str = mysql_real_escape_string($string);
|
$str = mysql_real_escape_string($string);
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
|
||||||
if (is_numeric ($field)) {
|
if (is_numeric ($field)) {
|
||||||
/* User provide the exact operation to do */
|
/* User provide the exact operation to do */
|
||||||
$query .= $value;
|
$query .= $value;
|
||||||
|
|
||||||
if ($i < $max) {
|
if ($i < $max) {
|
||||||
$query .= ' '.$join.' ';
|
$query .= ' '.$join.' ';
|
||||||
}
|
}
|
||||||
|
@ -908,7 +908,7 @@ function mysql_db_process_sql_delete($table, $where, $where_join = 'AND') {
|
||||||
$query .= db_format_array_where_clause_sql ($where, $where_join);
|
$query .= db_format_array_where_clause_sql ($where, $where_join);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return db_process_sql ($query);
|
return db_process_sql ($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1060,6 +1060,7 @@ function events_print_type_description ($type, $return = false) {
|
||||||
function events_get_group_events ($id_group, $period, $date,
|
function events_get_group_events ($id_group, $period, $date,
|
||||||
$filter_event_validated = false, $filter_event_critical = false,
|
$filter_event_validated = false, $filter_event_critical = false,
|
||||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
|
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
|
||||||
|
@ -1102,6 +1103,65 @@ function events_get_group_events ($id_group, $period, $date,
|
||||||
return db_get_all_rows_sql ($sql);
|
return db_get_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the events happened in a group during a period of time.
|
||||||
|
*
|
||||||
|
* The returned events will be in the time interval ($date - $period, $date]
|
||||||
|
*
|
||||||
|
* @param mixed $id_group Group id to get events for.
|
||||||
|
* @param int $period Period of time in seconds to get events.
|
||||||
|
* @param int $date Beginning date to get events.
|
||||||
|
*
|
||||||
|
* @return array An array with all the events happened.
|
||||||
|
*/
|
||||||
|
function events_get_group_events_steps ($begin, &$result, $id_group, $period, $date,
|
||||||
|
$filter_event_validated = false, $filter_event_critical = false,
|
||||||
|
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
|
||||||
|
|
||||||
|
if (empty ($id_group)) {
|
||||||
|
//An empty array means the user doesn't have access
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$datelimit = $date - $period;
|
||||||
|
|
||||||
|
$sql_where = ' AND 1 = 1 ';
|
||||||
|
if ($filter_event_critical) {
|
||||||
|
$sql_where .= ' AND criticity = 4 ';
|
||||||
|
}
|
||||||
|
if ($filter_event_warning) {
|
||||||
|
$sql_where .= ' AND criticity = 3 ';
|
||||||
|
}
|
||||||
|
if ($filter_event_validated) {
|
||||||
|
$sql_where .= ' AND estado = 1 ';
|
||||||
|
}
|
||||||
|
if ($filter_event_no_validated) {
|
||||||
|
$sql_where .= ' AND estado = 0 ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = sprintf ('SELECT *,
|
||||||
|
(SELECT t2.nombre
|
||||||
|
FROM tagente AS t2
|
||||||
|
WHERE t2.id_agente = t3.id_agente) AS agent_name,
|
||||||
|
(SELECT t2.fullname
|
||||||
|
FROM tusuario AS t2
|
||||||
|
WHERE t2.id_user = t3.id_usuario) AS user_name
|
||||||
|
FROM tevento AS t3
|
||||||
|
WHERE utimestamp > %d AND utimestamp <= %d
|
||||||
|
AND id_grupo IN (%s) ' . $sql_where . '
|
||||||
|
ORDER BY utimestamp ASC',
|
||||||
|
$datelimit, $date, implode (",", $id_group));
|
||||||
|
|
||||||
|
//html_debug_print($sql);
|
||||||
|
|
||||||
|
return db_get_all_row_by_steps_sql($begin, $result, $sql);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the events happened in an Agent during a period of time.
|
* Get all the events happened in an Agent during a period of time.
|
||||||
*
|
*
|
||||||
|
|
|
@ -183,7 +183,7 @@ function reporting_get_agentmodule_data_max ($id_agent_module, $period, $date =
|
||||||
$previous_data['utimestamp'] = $datelimit;
|
$previous_data['utimestamp'] = $datelimit;
|
||||||
array_unshift ($interval_data, $previous_data);
|
array_unshift ($interval_data, $previous_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get next data
|
// Get next data
|
||||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||||
if ($next_data !== false) {
|
if ($next_data !== false) {
|
||||||
|
@ -347,7 +347,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, $period, $date =
|
||||||
$previous_data['utimestamp'] = $datelimit;
|
$previous_data['utimestamp'] = $datelimit;
|
||||||
array_unshift ($interval_data, $previous_data);
|
array_unshift ($interval_data, $previous_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get next data
|
// Get next data
|
||||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||||
if ($next_data !== false) {
|
if ($next_data !== false) {
|
||||||
|
@ -429,7 +429,7 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||||
WHERE id_agente_modulo = %d
|
WHERE id_agente_modulo = %d
|
||||||
AND utimestamp > %d AND utimestamp <= %d',
|
AND utimestamp > %d AND utimestamp <= %d',
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
|
|
||||||
//Add the working times (mon - tue - wed ...) and from time to time
|
//Add the working times (mon - tue - wed ...) and from time to time
|
||||||
$days = array();
|
$days = array();
|
||||||
//Translate to mysql week days
|
//Translate to mysql week days
|
||||||
|
@ -537,17 +537,18 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||||
$previous_utimestamp = $first_data['utimestamp'];
|
$previous_utimestamp = $first_data['utimestamp'];
|
||||||
if ((($max_value > $min_value AND ($first_data['datos'] > $max_value OR $first_data['datos'] < $min_value))) OR
|
if ((($max_value > $min_value AND ($first_data['datos'] > $max_value OR $first_data['datos'] < $min_value))) OR
|
||||||
($max_value <= $min_value AND $first_data['datos'] < $min_value)) {
|
($max_value <= $min_value AND $first_data['datos'] < $min_value)) {
|
||||||
$previous_status = 1;
|
|
||||||
foreach ($downtime_dates as $date_dt) {
|
$previous_status = 1;
|
||||||
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
|
foreach ($downtime_dates as $date_dt) {
|
||||||
$previous_status = 0;
|
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
|
||||||
}
|
$previous_status = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$previous_status = 0;
|
$previous_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($interval_data as $data) {
|
foreach ($interval_data as $data) {
|
||||||
// Previous status was critical
|
// Previous status was critical
|
||||||
if ($previous_status == 1) {
|
if ($previous_status == 1) {
|
||||||
|
@ -671,7 +672,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
foreach($interval_data as $idata) {
|
foreach($interval_data as $idata) {
|
||||||
$interval_data_indexed[$idata['utimestamp']]['data'] = $idata['datos'];
|
$interval_data_indexed[$idata['utimestamp']]['data'] = $idata['datos'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------Calculate unknown status events------------------------
|
//-----------Calculate unknown status events------------------------
|
||||||
$events_unknown = db_get_all_rows_filter ('tevento',
|
$events_unknown = db_get_all_rows_filter ('tevento',
|
||||||
array ('id_agentmodule' => $id_agent_module,
|
array ('id_agentmodule' => $id_agent_module,
|
||||||
|
@ -680,7 +681,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
"event_type" => 'going_unknown',
|
"event_type" => 'going_unknown',
|
||||||
'order' => 'utimestamp ASC'),
|
'order' => 'utimestamp ASC'),
|
||||||
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
||||||
|
|
||||||
if ($events_unknown === false) {
|
if ($events_unknown === false) {
|
||||||
$events_unknown = array ();
|
$events_unknown = array ();
|
||||||
}
|
}
|
||||||
|
@ -690,7 +691,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the last event before inverval to know if graph start on unknown
|
// Get the last event before inverval to know if graph start on unknown
|
||||||
$prev_event = db_get_row_filter ('tevento',
|
$prev_event = db_get_row_filter ('tevento',
|
||||||
array ('id_agentmodule' => $id_agent_module,
|
array ('id_agentmodule' => $id_agent_module,
|
||||||
|
@ -703,7 +704,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$start_unknown = false;
|
$start_unknown = false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
//-----------------Set limits of the interval-----------------------
|
//-----------------Set limits of the interval-----------------------
|
||||||
// If the starting of the graph is unknown we set it
|
// If the starting of the graph is unknown we set it
|
||||||
if($start_unknown) {
|
if($start_unknown) {
|
||||||
|
@ -713,7 +714,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
else {
|
else {
|
||||||
// Get previous data (This adds the first data if the begin of module data is after the begin time interval)
|
// Get previous data (This adds the first data if the begin of module data is after the begin time interval)
|
||||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||||
|
|
||||||
if ($previous_data !== false ) {
|
if ($previous_data !== false ) {
|
||||||
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
||||||
}
|
}
|
||||||
|
@ -722,7 +723,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get next data (This adds data before the interval of the report)
|
// Get next data (This adds data before the interval of the report)
|
||||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||||
if ($next_data !== false) {
|
if ($next_data !== false) {
|
||||||
|
@ -734,7 +735,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$last_data = array_pop($interval_data_indexed);
|
$last_data = array_pop($interval_data_indexed);
|
||||||
$interval_data_indexed[$date] = $last_data;
|
$interval_data_indexed[$date] = $last_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
//--------Calculate planned downtime dates--------------------------
|
//--------Calculate planned downtime dates--------------------------
|
||||||
|
@ -746,7 +747,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$downtime_dates = array();
|
$downtime_dates = array();
|
||||||
|
|
||||||
foreach ($downtimes as $downtime) {
|
foreach ($downtimes as $downtime) {
|
||||||
$id_downtime = $downtime['id_downtime'];
|
$id_downtime = $downtime['id_downtime'];
|
||||||
$sql_date = "SELECT date_from, date_to FROM tplanned_downtime WHERE id=$id_downtime";
|
$sql_date = "SELECT date_from, date_to FROM tplanned_downtime WHERE id=$id_downtime";
|
||||||
|
@ -781,7 +782,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
|
|
||||||
// Sort the array
|
// Sort the array
|
||||||
ksort($interval_data_indexed);
|
ksort($interval_data_indexed);
|
||||||
|
|
||||||
// We need more or equal two points
|
// We need more or equal two points
|
||||||
if (count ($interval_data_indexed) < 2) {
|
if (count ($interval_data_indexed) < 2) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1003,7 +1004,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
if (!empty($group_array)) {
|
if (!empty($group_array)) {
|
||||||
// FOR THE FUTURE: Split the groups into groups with tags restrictions and groups without it
|
// FOR THE FUTURE: Split the groups into groups with tags restrictions and groups without it
|
||||||
// To calculate in the light way the non tag restricted and in the heavy way the others
|
// To calculate in the light way the non tag restricted and in the heavy way the others
|
||||||
/*
|
/*
|
||||||
$group_restricted_data = tags_get_acl_tags($config['id_user'], $group_array, $access, 'data');
|
$group_restricted_data = tags_get_acl_tags($config['id_user'], $group_array, $access, 'data');
|
||||||
$tags_restricted_groups = array_keys($group_restricted_data);
|
$tags_restricted_groups = array_keys($group_restricted_data);
|
||||||
|
|
||||||
|
@ -1018,13 +1019,13 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
if(!empty($group_array)) {
|
if(!empty($group_array)) {
|
||||||
// Get unknown agents by using the status code in modules
|
// Get unknown agents by using the status code in modules
|
||||||
$data["agents_unknown"] += groups_agent_unknown ($group_array);
|
$data["agents_unknown"] += groups_agent_unknown ($group_array);
|
||||||
|
|
||||||
// Get monitor NOT INIT, except disabled AND async modules
|
// Get monitor NOT INIT, except disabled AND async modules
|
||||||
$data["monitor_not_init"] += groups_monitor_not_init ($group_array);
|
$data["monitor_not_init"] += groups_monitor_not_init ($group_array);
|
||||||
|
|
||||||
// Get monitor OK, except disabled and non-init
|
// Get monitor OK, except disabled and non-init
|
||||||
$data["monitor_ok"] += groups_monitor_ok ($group_array);
|
$data["monitor_ok"] += groups_monitor_ok ($group_array);
|
||||||
|
|
||||||
// Get monitor CRITICAL, except disabled and non-init
|
// Get monitor CRITICAL, except disabled and non-init
|
||||||
$data["monitor_critical"] += groups_monitor_critical ($group_array);
|
$data["monitor_critical"] += groups_monitor_critical ($group_array);
|
||||||
|
|
||||||
|
@ -1068,9 +1069,9 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
||||||
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
|
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get total count of monitors for this group, except disabled.
|
// Get total count of monitors for this group, except disabled.
|
||||||
|
|
||||||
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
|
$data["monitor_checks"] = $data["monitor_not_init"] + $data["monitor_unknown"] + $data["monitor_warning"] + $data["monitor_critical"] + $data["monitor_ok"];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1173,6 +1174,7 @@ function reporting_event_reporting ($id_group, $period, $date = 0, $return = fal
|
||||||
|
|
||||||
if (empty ($return))
|
if (empty ($return))
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2096,68 +2098,64 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
||||||
$table->head[5] = __('Val. by');
|
$table->head[5] = __('Val. by');
|
||||||
$table->head[6] = __('Timestamp');
|
$table->head[6] = __('Timestamp');
|
||||||
|
|
||||||
$events = events_get_group_events($id_group, $period, $date,
|
$begin = true;
|
||||||
|
$result = null;
|
||||||
|
$count = 0;
|
||||||
|
while ($event = events_get_group_events_steps($begin, $result, $id_group, $period, $date,
|
||||||
$filter_event_validated, $filter_event_critical,
|
$filter_event_validated, $filter_event_critical,
|
||||||
$filter_event_warning, $filter_event_no_validated);
|
$filter_event_warning, $filter_event_no_validated)) {
|
||||||
|
|
||||||
if ($events) {
|
|
||||||
foreach ($events as $event) {
|
|
||||||
//First pass along the class of this row
|
|
||||||
$table->rowclass[] =
|
|
||||||
get_priority_class ($event["criticity"]);
|
|
||||||
|
|
||||||
$data = array ();
|
|
||||||
|
|
||||||
// Colored box
|
|
||||||
switch ($event['estado']) {
|
|
||||||
case 0:
|
|
||||||
$img_st = "images/star.png";
|
|
||||||
$title_st = __('New event');
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$img_st = "images/tick.png";
|
|
||||||
$title_st = __('Event validated');
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$img_st = "images/hourglass.png";
|
|
||||||
$title_st = __('Event in process');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$data[] = html_print_image ($img_st, true,
|
|
||||||
array ("class" => "image_status",
|
|
||||||
"width" => 16,
|
|
||||||
"height" => 16,
|
|
||||||
"title" => $title_st,
|
|
||||||
"id" => 'status_img_' . $event["id_evento"]));
|
|
||||||
|
|
||||||
$data[] = ui_print_truncate_text(
|
|
||||||
io_safe_output($event['evento']),
|
|
||||||
140, false, true);
|
|
||||||
|
|
||||||
//$data[1] = $event['event_type'];
|
|
||||||
$data[] = events_print_type_img ($event["event_type"], true);
|
|
||||||
|
|
||||||
if (!empty($event['agent_name']))
|
|
||||||
$data[] = $event['agent_name'];
|
|
||||||
else
|
|
||||||
$data[] = __('Pandora System');
|
|
||||||
$data[] = get_priority_name ($event['criticity']);
|
|
||||||
$data[] = io_safe_output($event['user_name']);
|
|
||||||
$data[] = '<font style="font-size: 6pt;">' .
|
|
||||||
$event['timestamp'] .
|
|
||||||
'</font>';
|
|
||||||
array_push ($table->data, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($html) {
|
//html_debug_print(++$count, true);
|
||||||
return html_print_table ($table, $return);
|
|
||||||
}
|
$data = array ();
|
||||||
else {
|
$begin = false;
|
||||||
return $table;
|
|
||||||
|
// Colored box
|
||||||
|
switch ($event['estado']) {
|
||||||
|
case 0:
|
||||||
|
$img_st = "images/star.png";
|
||||||
|
$title_st = __('New event');
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$img_st = "images/tick.png";
|
||||||
|
$title_st = __('Event validated');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$img_st = "images/hourglass.png";
|
||||||
|
$title_st = __('Event in process');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
$data[] = html_print_image ($img_st, true,
|
||||||
|
array ("class" => "image_status",
|
||||||
|
"width" => 16,
|
||||||
|
"height" => 16,
|
||||||
|
"title" => $title_st,
|
||||||
|
"id" => 'status_img_' . $event["id_evento"]));
|
||||||
|
|
||||||
|
$data[] = ui_print_truncate_text(
|
||||||
|
io_safe_output($event['evento']),
|
||||||
|
140, false, true);
|
||||||
|
|
||||||
|
//$data[1] = $event['event_type'];
|
||||||
|
$data[] = events_print_type_img ($event["event_type"], true);
|
||||||
|
|
||||||
|
if (!empty($event['agent_name']))
|
||||||
|
$data[] = $event['agent_name'];
|
||||||
|
else
|
||||||
|
$data[] = __('Pandora System');
|
||||||
|
$data[] = get_priority_name ($event['criticity']);
|
||||||
|
$data[] = io_safe_output($event['user_name']);
|
||||||
|
$data[] = '<font style="font-size: 6pt;">' .
|
||||||
|
$event['timestamp'] .
|
||||||
|
'</font>';
|
||||||
|
array_push ($table->data, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($html) {
|
||||||
|
return html_print_table ($table, $return);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2303,7 +2301,7 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return["modules"] > 0) {
|
if ($return["modules"] > 0) {
|
||||||
if ($return["monitor_critical"] > 0) {
|
if ($return["monitor_critical"] > 0) {
|
||||||
$return["status"] = STATUS_AGENT_CRITICAL;
|
$return["status"] = STATUS_AGENT_CRITICAL;
|
||||||
|
@ -2336,7 +2334,7 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the callback sorting function for SLA values descending
|
* This is the callback sorting function for SLA values descending
|
||||||
|
|
|
@ -121,7 +121,7 @@ if (isset ($_GET["direct"])) {
|
||||||
else {
|
else {
|
||||||
require_once ("include/config.php");
|
require_once ("include/config.php");
|
||||||
require_once ("include/functions_reporting.php");
|
require_once ("include/functions_reporting.php");
|
||||||
require_once ("include/auth/mysql.php");
|
require_once ("include/auth/mysql.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -733,18 +733,18 @@ foreach ($contents as $content) {
|
||||||
$id_group = groups_safe_acl ($config["id_user"], $content['id_group'], "AR");
|
$id_group = groups_safe_acl ($config["id_user"], $content['id_group'], "AR");
|
||||||
///
|
///
|
||||||
if (!empty ($id_group)) {
|
if (!empty ($id_group)) {
|
||||||
|
|
||||||
//An empty array means the user doesn't have access
|
//An empty array means the user doesn't have access
|
||||||
$datelimit = $report["datetime"] - $content['period'];
|
$datelimit = $report["datetime"] - $content['period'];
|
||||||
|
|
||||||
$sql_count = sprintf ('SELECT count(*) FROM tevento
|
$sql_count = sprintf ('SELECT count(*) FROM tevento
|
||||||
WHERE utimestamp > %d AND utimestamp <= %d
|
WHERE utimestamp > %d AND utimestamp <= %d
|
||||||
AND id_grupo IN (%s)
|
AND id_grupo IN (%s)
|
||||||
ORDER BY utimestamp ASC',
|
ORDER BY utimestamp ASC',
|
||||||
$datelimit, $report["datetime"], implode (",", $id_group));
|
$datelimit, $report["datetime"], implode (",", $id_group));
|
||||||
|
|
||||||
$data_count = db_get_value_sql($sql_count);
|
$data_count = db_get_value_sql($sql_count);
|
||||||
|
|
||||||
$temp_file = $config['attachment_store'] . '/event_report_group_' . $time.'_'.$content['id_rc'] . '.tmp';
|
$temp_file = $config['attachment_store'] . '/event_report_group_' . $time.'_'.$content['id_rc'] . '.tmp';
|
||||||
$file = fopen ($temp_file, 'a+');
|
$file = fopen ($temp_file, 'a+');
|
||||||
$buffer_file["objdata"] = $config['attachment_store'] . '/event_report_group_' . $time.'_'.$content['id_rc'] . '.tmp';
|
$buffer_file["objdata"] = $config['attachment_store'] . '/event_report_group_' . $time.'_'.$content['id_rc'] . '.tmp';
|
||||||
|
@ -756,7 +756,8 @@ foreach ($contents as $content) {
|
||||||
$content_report = " <event_report_group/>\n";
|
$content_report = " <event_report_group/>\n";
|
||||||
$result = fwrite($file, $content_report);
|
$result = fwrite($file, $content_report);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
} else if ($data_count <= $limit) {
|
}
|
||||||
|
else if ($data_count <= $limit) {
|
||||||
$content_report = " <event_report_group>\n";
|
$content_report = " <event_report_group>\n";
|
||||||
$result = fwrite($file, $content_report);
|
$result = fwrite($file, $content_report);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
@ -772,8 +773,9 @@ foreach ($contents as $content) {
|
||||||
$file = fopen ($temp_file, 'a+');
|
$file = fopen ($temp_file, 'a+');
|
||||||
$content_report = " </event_report_group>\n";
|
$content_report = " </event_report_group>\n";
|
||||||
$result = fwrite($file, $content_report);
|
$result = fwrite($file, $content_report);
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$content_report = " <event_report_group>\n";
|
$content_report = " <event_report_group>\n";
|
||||||
$result = fwrite($file, $content_report);
|
$result = fwrite($file, $content_report);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
@ -786,7 +788,7 @@ foreach ($contents as $content) {
|
||||||
AND id_grupo IN (%s)
|
AND id_grupo IN (%s)
|
||||||
ORDER BY utimestamp ASC LIMIT %d,%d',
|
ORDER BY utimestamp ASC LIMIT %d,%d',
|
||||||
$datelimit, $report["datetime"], implode (",", $id_group), $offset,$limit);
|
$datelimit, $report["datetime"], implode (",", $id_group), $offset,$limit);
|
||||||
|
|
||||||
$events = db_get_all_rows_sql($sql);
|
$events = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
$position = xml_file_event ($events, $temp_file, $position, $content['id_agent']);
|
$position = xml_file_event ($events, $temp_file, $position, $content['id_agent']);
|
||||||
|
|
Loading…
Reference in New Issue