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%';
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
|
@ -537,6 +537,7 @@ 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;
|
$previous_status = 1;
|
||||||
foreach ($downtime_dates as $date_dt) {
|
foreach ($downtime_dates as $date_dt) {
|
||||||
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
|
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
|
||||||
|
@ -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,17 +2098,17 @@ 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) {
|
//html_debug_print(++$count, true);
|
||||||
foreach ($events as $event) {
|
|
||||||
//First pass along the class of this row
|
|
||||||
$table->rowclass[] =
|
|
||||||
get_priority_class ($event["criticity"]);
|
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
$begin = false;
|
||||||
|
|
||||||
// Colored box
|
// Colored box
|
||||||
switch ($event['estado']) {
|
switch ($event['estado']) {
|
||||||
|
@ -2156,10 +2158,6 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a detailed report of summarized events per agent
|
* Get a detailed report of summarized events per agent
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -773,7 +774,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);
|
||||||
|
|
||||||
} 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);
|
||||||
|
|
Loading…
Reference in New Issue