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:
parent
c5c2aa50da
commit
20d5276ff0
|
@ -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>
|
||||
|
||||
* godmode/reporting/reporting_builder.item_editor.php: fixed lost
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
/**
|
||||
* Include the usual functions
|
||||
*/
|
||||
require_once ($config["homedir"]."/include/functions.php");
|
||||
require_once ($config["homedir"]."/include/functions_db.php");
|
||||
require_once ($config["homedir"]."/include/functions_agents.php");
|
||||
require_once($config["homedir"] . "/include/functions.php");
|
||||
require_once($config["homedir"] . "/include/functions_db.php");
|
||||
require_once($config["homedir"] . "/include/functions_agents.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_events.php");
|
||||
include_once($config['homedir'] . "/include/functions_alerts.php");
|
||||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
enterprise_include_once ('include/functions_metaconsole.php');
|
||||
enterprise_include_once ('include/functions_inventory.php');
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('include/functions_inventory.php');
|
||||
include_once($config['homedir'] . "/include/functions_forecast.php");
|
||||
include_once($config['homedir'] . "/include/functions_ui.php");
|
||||
include_once($config['homedir'] . "/include/functions_netflow.php");
|
||||
|
@ -3633,6 +3633,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
if ($content['header_definition'] != '') {
|
||||
$table2->head = explode('|', $content['header_definition']);
|
||||
}
|
||||
else {
|
||||
$table2->head[] = __('Data');
|
||||
}
|
||||
array_unshift($table2->head, __('Date'));
|
||||
|
||||
$datelimit = $report["datetime"] - $content['period'];
|
||||
|
@ -3658,10 +3661,20 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$table2->data = array();
|
||||
foreach ($result as $row) {
|
||||
$date = date ($config["date_format"], $row['utimestamp']);
|
||||
$serialized = $row['datos'];
|
||||
$rowsUnserialize = explode($content['line_separator'], $serialized);
|
||||
$serialized = $row['datos'];
|
||||
|
||||
$rowsUnserialize = (array)$serialized;
|
||||
if (!empty($content['line_separator'])) {
|
||||
$rowsUnserialize = explode($line_separator,
|
||||
$serialized);
|
||||
}
|
||||
|
||||
foreach ($rowsUnserialize as $rowUnser) {
|
||||
$columnsUnserialize = explode($content['column_separator'], $rowUnser);
|
||||
$columnsUnserialize = (array)$rowUnser;
|
||||
if (!empty($content['column_separator'])) {
|
||||
$columnsUnserialize = explode($content['column_separator'], $rowUnser);
|
||||
}
|
||||
|
||||
array_unshift($columnsUnserialize, $date);
|
||||
array_push($table2->data, $columnsUnserialize);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ include_once ('include/functions_netflow.php');
|
|||
//xml con los datos de un agente
|
||||
function xml_file_agent_data ($agent_data = array(), $file_temp) {
|
||||
$file = fopen($file_temp, 'a+');
|
||||
|
||||
|
||||
$content_report = " <name>". $agent_data['nombre']."</name>\n";
|
||||
$content_report .= " <description>". $agent_data['comentarios']."</description>\n";
|
||||
$content_report .= " <main_ipaddress>".$agent_data['direccion']."</main_ipaddress>\n";
|
||||
|
@ -49,7 +49,7 @@ function xml_file_agent_data ($agent_data = array(), $file_temp) {
|
|||
|
||||
$result = fwrite($file, $content_report);
|
||||
$position++;
|
||||
|
||||
|
||||
fclose($file);
|
||||
return $position;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id
|
|||
foreach ($modules as $module) {
|
||||
|
||||
$content_report = " <object id=\"$position\">\n";
|
||||
|
||||
|
||||
$content_report .= " <name>".$module['nombre']."</name>\n";
|
||||
$content_report .= " <id>".$module['id_agente_modulo']."</id>\n";
|
||||
$content_report .= " <type>".$module['id_tipo_modulo']."</type>\n";
|
||||
|
@ -101,6 +101,7 @@ function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id
|
|||
$position++;
|
||||
}
|
||||
fclose($file);
|
||||
|
||||
return $position;
|
||||
}
|
||||
|
||||
|
@ -142,6 +143,7 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent
|
|||
|
||||
}
|
||||
fclose($file);
|
||||
|
||||
return $position;
|
||||
}
|
||||
|
||||
|
@ -163,6 +165,7 @@ function xml_file_graph ($data_module = array(), $file_temp, $position = 0) {
|
|||
}
|
||||
|
||||
fclose($file);
|
||||
|
||||
return $position;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -164,7 +164,9 @@ $time = (string) get_parameter ('time', date ('h:iA'));
|
|||
$datetime = strtotime ($date.' '.$time);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -291,7 +293,7 @@ foreach ($contents as $content) {
|
|||
$position = 0;
|
||||
while ($offset < $data_count) {
|
||||
|
||||
$sql = "SELECT *
|
||||
$sql = "SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo=".$content['id_agent_module']."
|
||||
AND (utimestamp>=$date_init AND utimestamp<=$date_end) LIMIT $offset,$limit";
|
||||
|
@ -381,7 +383,7 @@ foreach ($contents as $content) {
|
|||
case 2:
|
||||
case 'custom_graph':
|
||||
case 'automatic_custom_graph':
|
||||
|
||||
|
||||
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
|
||||
$data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));
|
||||
|
||||
|
@ -406,38 +408,44 @@ foreach ($contents as $content) {
|
|||
$date_init = $date_end - $content['period'];
|
||||
///
|
||||
$temp_file = $config['attachment_store'] . '/custom_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
|
||||
|
||||
|
||||
$file = fopen ($temp_file, 'a+');
|
||||
|
||||
|
||||
$buffer_file["objdata"] = $config['attachment_store'] . '/custom_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
|
||||
|
||||
|
||||
$limit = 1000;
|
||||
$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)";
|
||||
$data_count = db_get_value_sql($sql_count);
|
||||
|
||||
|
||||
if ($data_count == false) {
|
||||
$content_report = " <custom_graph/>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
} else if ($data_count <= $limit) {
|
||||
}
|
||||
else if ($data_count <= $limit) {
|
||||
$content_report = " <custom_graph>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
|
||||
$sql = "SELECT * FROM tagente_datos WHERE id_agente_modulo=".$content2['id_agent_module']."
|
||||
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo=".$content2['id_agent_module']."
|
||||
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
|
||||
|
||||
$data_module = db_get_all_rows_sql($sql);
|
||||
xml_file_graph ($data_module, $temp_file);
|
||||
|
||||
$file = fopen ($temp_file, 'a+');
|
||||
$content_report = " </custom_graph>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
$content_report = " <custom_graph>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
|
@ -486,7 +494,7 @@ foreach ($contents as $content) {
|
|||
}
|
||||
|
||||
$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["max"] = $sla['sla_max'];
|
||||
$sla_data["min"] = $sla['sla_min'];
|
||||
|
@ -958,14 +966,27 @@ foreach ($contents as $content) {
|
|||
if ($content['header_definition'] != '') {
|
||||
$tags = explode('|', $content['header_definition']);
|
||||
}
|
||||
else {
|
||||
$tags[] = 'Data';
|
||||
}
|
||||
array_unshift($tags, 'Date');
|
||||
|
||||
$datelimit = $report["datetime"] - $content['period'];
|
||||
|
||||
$result = db_get_all_rows_sql('SELECT *
|
||||
FROM tagente_datos_string
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
|
||||
AND utimestamp > ' . $datelimit . ' AND utimestamp <= ' . $report["datetime"]);
|
||||
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 *
|
||||
FROM tagente_datos_string
|
||||
WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
|
||||
AND utimestamp > ' . $datelimit . '
|
||||
AND utimestamp <= ' . $report["datetime"]);
|
||||
}
|
||||
if ($result === false) {
|
||||
$result = array();
|
||||
}
|
||||
|
@ -974,9 +995,20 @@ foreach ($contents as $content) {
|
|||
foreach ($result as $row) {
|
||||
$date = date ($config["date_format"], $row['utimestamp']);
|
||||
$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) {
|
||||
$columnsUnserialize = explode($content['column_separator'], $rowUnser);
|
||||
|
||||
$columnsUnserialize = (array)$rowUnser;
|
||||
if (!empty($content['column_separator'])) {
|
||||
$columnsUnserialize = explode($content['column_separator'], $rowUnser);
|
||||
}
|
||||
|
||||
array_unshift($columnsUnserialize, $date);
|
||||
|
||||
$objdata = array ();
|
||||
|
|
Loading…
Reference in New Issue