2013-02-04 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_xml.php, include/functions_reporting.php,
	operation/reporting/reporting_xml.php: fixed the SLA agent name
	with entities differents to hexadecimal entities. And fixed the
	serialized data when has not separators.
	
	Fixes: #3602204




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7571 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-04 14:07:28 +00:00
parent c5c2aa50da
commit 20d5276ff0
4 changed files with 89 additions and 32 deletions

View File

@ -1,3 +1,12 @@
2013-02-04 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_xml.php, include/functions_reporting.php,
operation/reporting/reporting_xml.php: fixed the SLA agent name
with entities differents to hexadecimal entities. And fixed the
serialized data when has not separators.
Fixes: #3602204
2013-02-04 Miguel de Dios <miguel.dedios@artica.es> 2013-02-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php: fixed lost * godmode/reporting/reporting_builder.item_editor.php: fixed lost

View File

@ -26,7 +26,7 @@ require_once ($config["homedir"]."/include/functions.php");
require_once($config["homedir"] . "/include/functions_db.php"); require_once($config["homedir"] . "/include/functions_db.php");
require_once($config["homedir"] . "/include/functions_agents.php"); require_once($config["homedir"] . "/include/functions_agents.php");
include_once($config["homedir"] . "/include/functions_groups.php"); include_once($config["homedir"] . "/include/functions_groups.php");
require_once ('functions_graph.php'); require_once($config["homedir"] . '/include/functions_graph.php');
include_once($config['homedir'] . "/include/functions_modules.php"); include_once($config['homedir'] . "/include/functions_modules.php");
include_once($config['homedir'] . "/include/functions_events.php"); include_once($config['homedir'] . "/include/functions_events.php");
include_once($config['homedir'] . "/include/functions_alerts.php"); include_once($config['homedir'] . "/include/functions_alerts.php");
@ -3633,6 +3633,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
if ($content['header_definition'] != '') { if ($content['header_definition'] != '') {
$table2->head = explode('|', $content['header_definition']); $table2->head = explode('|', $content['header_definition']);
} }
else {
$table2->head[] = __('Data');
}
array_unshift($table2->head, __('Date')); array_unshift($table2->head, __('Date'));
$datelimit = $report["datetime"] - $content['period']; $datelimit = $report["datetime"] - $content['period'];
@ -3659,9 +3662,19 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($result as $row) { foreach ($result as $row) {
$date = date ($config["date_format"], $row['utimestamp']); $date = date ($config["date_format"], $row['utimestamp']);
$serialized = $row['datos']; $serialized = $row['datos'];
$rowsUnserialize = explode($content['line_separator'], $serialized);
$rowsUnserialize = (array)$serialized;
if (!empty($content['line_separator'])) {
$rowsUnserialize = explode($line_separator,
$serialized);
}
foreach ($rowsUnserialize as $rowUnser) { foreach ($rowsUnserialize as $rowUnser) {
$columnsUnserialize = (array)$rowUnser;
if (!empty($content['column_separator'])) {
$columnsUnserialize = explode($content['column_separator'], $rowUnser); $columnsUnserialize = explode($content['column_separator'], $rowUnser);
}
array_unshift($columnsUnserialize, $date); array_unshift($columnsUnserialize, $date);
array_push($table2->data, $columnsUnserialize); array_push($table2->data, $columnsUnserialize);
} }

View File

@ -101,6 +101,7 @@ function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id
$position++; $position++;
} }
fclose($file); fclose($file);
return $position; return $position;
} }
@ -142,6 +143,7 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent
} }
fclose($file); fclose($file);
return $position; return $position;
} }
@ -163,6 +165,7 @@ function xml_file_graph ($data_module = array(), $file_temp, $position = 0) {
} }
fclose($file); fclose($file);
return $position; return $position;
} }
?> ?>

View File

@ -164,7 +164,9 @@ $time = (string) get_parameter ('time', date ('h:iA'));
$datetime = strtotime ($date.' '.$time); $datetime = strtotime ($date.' '.$time);
if ($datetime === false || $datetime == -1) { if ($datetime === false || $datetime == -1) {
echo "<error>Invalid date selected</error>"; //Not translatable because this is an error message and might have to be used on the other end //Not translatable because this is an error message and might have
//to be used on the other end
echo "<error>Invalid date selected</error>";
exit; exit;
} }
@ -414,7 +416,9 @@ foreach ($contents as $content) {
$limit = 1000; $limit = 1000;
$offset = 0; $offset = 0;
$sql_count = "SELECT COUNT(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=".$content2['id_agent_module']." $sql_count = "SELECT COUNT(id_agente_modulo)
FROM tagente_datos
WHERE id_agente_modulo=".$content2['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)"; AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_count = db_get_value_sql($sql_count); $data_count = db_get_value_sql($sql_count);
@ -422,12 +426,15 @@ foreach ($contents as $content) {
$content_report = " <custom_graph/>\n"; $content_report = " <custom_graph/>\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 = " <custom_graph>\n"; $content_report = " <custom_graph>\n";
$result = fwrite($file, $content_report); $result = fwrite($file, $content_report);
fclose($file); fclose($file);
$sql = "SELECT * FROM tagente_datos WHERE id_agente_modulo=".$content2['id_agent_module']." $sql = "SELECT *
FROM tagente_datos
WHERE id_agente_modulo=".$content2['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)"; AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_module = db_get_all_rows_sql($sql); $data_module = db_get_all_rows_sql($sql);
@ -437,7 +444,8 @@ foreach ($contents as $content) {
$content_report = " </custom_graph>\n"; $content_report = " </custom_graph>\n";
$result = fwrite($file, $content_report); $result = fwrite($file, $content_report);
} else { }
else {
$content_report = " <custom_graph>\n"; $content_report = " <custom_graph>\n";
$result = fwrite($file, $content_report); $result = fwrite($file, $content_report);
fclose($file); fclose($file);
@ -486,7 +494,7 @@ foreach ($contents as $content) {
} }
$sla_data = array (); $sla_data = array ();
$sla_data["agent"] = modules_get_agentmodule_agent_name ($sla['id_agent_module']); $sla_data["agent"] = io_safe_output(modules_get_agentmodule_agent_name ($sla['id_agent_module']));
$sla_data["module"] = modules_get_agentmodule_name ($sla['id_agent_module']); $sla_data["module"] = modules_get_agentmodule_name ($sla['id_agent_module']);
$sla_data["max"] = $sla['sla_max']; $sla_data["max"] = $sla['sla_max'];
$sla_data["min"] = $sla['sla_min']; $sla_data["min"] = $sla['sla_min'];
@ -958,14 +966,27 @@ foreach ($contents as $content) {
if ($content['header_definition'] != '') { if ($content['header_definition'] != '') {
$tags = explode('|', $content['header_definition']); $tags = explode('|', $content['header_definition']);
} }
else {
$tags[] = 'Data';
}
array_unshift($tags, 'Date'); array_unshift($tags, 'Date');
$datelimit = $report["datetime"] - $content['period']; $datelimit = $report["datetime"] - $content['period'];
$result = db_get_all_rows_sql('SELECT *
FROM tagente_datos
WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . '
AND utimestamp <= ' . $report["datetime"]);
// Adds string data if there is no numeric data
if ((count($result) < 0) or (!$result)){
$result = db_get_all_rows_sql('SELECT * $result = db_get_all_rows_sql('SELECT *
FROM tagente_datos_string FROM tagente_datos_string
WHERE id_agente_modulo = ' . $content['id_agent_module'] . ' WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . ' AND utimestamp <= ' . $report["datetime"]); AND utimestamp > ' . $datelimit . '
AND utimestamp <= ' . $report["datetime"]);
}
if ($result === false) { if ($result === false) {
$result = array(); $result = array();
} }
@ -974,9 +995,20 @@ foreach ($contents as $content) {
foreach ($result as $row) { foreach ($result as $row) {
$date = date ($config["date_format"], $row['utimestamp']); $date = date ($config["date_format"], $row['utimestamp']);
$serialized = $row['datos']; $serialized = $row['datos'];
$rowsUnserialize = explode($content['line_separator'], $serialized);
$rowsUnserialize = (array)$serialized;
if (!empty($content['line_separator'])) {
$rowsUnserialize = explode($line_separator,
$serialized);
}
foreach ($rowsUnserialize as $rowUnser) { foreach ($rowsUnserialize as $rowUnser) {
$columnsUnserialize = (array)$rowUnser;
if (!empty($content['column_separator'])) {
$columnsUnserialize = explode($content['column_separator'], $rowUnser); $columnsUnserialize = explode($content['column_separator'], $rowUnser);
}
array_unshift($columnsUnserialize, $date); array_unshift($columnsUnserialize, $date);
$objdata = array (); $objdata = array ();