mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2014-03-01 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, operation/agentes/exportdata.php: fixed the export data from modules with string data. Incident: #707 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9695 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
af9cf1f51a
commit
e3f38440d3
@ -1,3 +1,10 @@
|
|||||||
|
2014-03-01 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_modules.php, operation/agentes/exportdata.php:
|
||||||
|
fixed the export data from modules with string data.
|
||||||
|
|
||||||
|
Incident: #707
|
||||||
|
|
||||||
2014-04-01 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
2014-04-01 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||||
|
|
||||||
* include/functions_networkmap.php: Modified the L2
|
* include/functions_networkmap.php: Modified the L2
|
||||||
|
@ -1254,7 +1254,8 @@ function modules_get_moduletypes ($type = "all", $rows = "nombre") {
|
|||||||
return array_merge (range (1,4), range (19,24));
|
return array_merge (range (1,4), range (19,24));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ("SELECT id_tipo, %s FROM ttipo_modulo", implode (",", $rows));
|
$sql = sprintf ("SELECT id_tipo, %s
|
||||||
|
FROM ttipo_modulo", implode (",", $rows));
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return $return;
|
return $return;
|
||||||
@ -1481,18 +1482,49 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
|
|||||||
* @return array The module value and the timestamp
|
* @return array The module value and the timestamp
|
||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0) {
|
function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0) {
|
||||||
|
$module = db_get_row('tagente_modulo', 'id_agente_modulo',
|
||||||
|
$id_agent_module);
|
||||||
|
|
||||||
if ($date < 1) {
|
if ($date < 1) {
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
}
|
}
|
||||||
|
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
|
|
||||||
|
switch ($module['id_tipo_modulo']) {
|
||||||
|
//generic_data_string
|
||||||
|
case 3:
|
||||||
|
//remote_tcp_string
|
||||||
|
case 10:
|
||||||
|
//remote_snmp_string
|
||||||
|
case 17:
|
||||||
|
//async_string
|
||||||
|
case 23:
|
||||||
|
$sql = sprintf ("SELECT datos AS data, utimestamp
|
||||||
|
FROM tagente_datos_string
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
|
ORDER BY utimestamp ASC",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
|
break;
|
||||||
|
//log4x
|
||||||
|
case 24:
|
||||||
|
$sql = sprintf ("SELECT datos AS data, utimestamp
|
||||||
|
FROM tagente_datos_log4x
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
|
ORDER BY utimestamp ASC",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
$sql = sprintf ("SELECT datos AS data, utimestamp
|
$sql = sprintf ("SELECT datos AS data, utimestamp
|
||||||
FROM tagente_datos
|
FROM tagente_datos
|
||||||
WHERE id_agente_modulo = %d
|
WHERE id_agente_modulo = %d
|
||||||
AND utimestamp > %d AND utimestamp <= %d
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
ORDER BY utimestamp ASC",
|
ORDER BY utimestamp ASC",
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$values = db_get_all_rows_sql ($sql, true, false);
|
$values = db_get_all_rows_sql ($sql, true, false);
|
||||||
|
|
||||||
|
@ -41,10 +41,12 @@ $agentName = get_parameter_post ('agent', 0);
|
|||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$agents = agents_get_agents (array('nombre LIKE "' . $agentName . '"'), array ('id_agente'));
|
$agents = agents_get_agents(
|
||||||
|
array('nombre LIKE "' . $agentName . '"'), array ('id_agente'));
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$agents = agents_get_agents (array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente'));
|
$agents = agents_get_agents(
|
||||||
|
array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$agent = $agents[0]['id_agente'];
|
$agent = $agents[0]['id_agente'];
|
||||||
@ -84,7 +86,13 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||||||
case "avg":
|
case "avg":
|
||||||
default:
|
default:
|
||||||
//HTML output - don't style or use XHTML just in case somebody needs to copy/paste it. (Office doesn't handle <thead> and <tbody>)
|
//HTML output - don't style or use XHTML just in case somebody needs to copy/paste it. (Office doesn't handle <thead> and <tbody>)
|
||||||
$datastart = '<table style="width:98%;"><tr><th>'.__('Agent').'</th><th>'.__('Module').'</th><th>'.__('Data').'</th><th>'.__('Timestamp').'</th></tr>';
|
$datastart = '<table style="width:98%;">' .
|
||||||
|
'<tr>' .
|
||||||
|
'<th>' . __('Agent') . '</th>' .
|
||||||
|
'<th>' . __('Module') . '</th>' .
|
||||||
|
'<th>' . __('Data') . '</th>' .
|
||||||
|
'<th>' .__('Timestamp') . '</th>' .
|
||||||
|
'</tr>';
|
||||||
$rowstart = '<tr><td style="text-align: center">';
|
$rowstart = '<tr><td style="text-align: center">';
|
||||||
$divider = '</td><td style="text-align: center">';
|
$divider = '</td><td style="text-align: center">';
|
||||||
$rowend = '</td></tr>';
|
$rowend = '</td></tr>';
|
||||||
@ -116,6 +124,7 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||||||
while ($work_end <= $end) {
|
while ($work_end <= $end) {
|
||||||
|
|
||||||
$data = array (); // Reinitialize array for each module chunk
|
$data = array (); // Reinitialize array for each module chunk
|
||||||
|
|
||||||
if ($export_type == "avg") {
|
if ($export_type == "avg") {
|
||||||
$arr = array ();
|
$arr = array ();
|
||||||
$arr["data"] = reporting_get_agentmodule_data_average ($selected, $work_period, $work_end);
|
$arr["data"] = reporting_get_agentmodule_data_average ($selected, $work_period, $work_end);
|
||||||
@ -129,7 +138,9 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||||||
array_push ($data, $arr);
|
array_push ($data, $arr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$data_single = modules_get_agentmodule_data ($selected, $work_period, $work_end);
|
$data_single = modules_get_agentmodule_data(
|
||||||
|
$selected, $work_period, $work_end);
|
||||||
|
|
||||||
if (!empty ($data_single)) {
|
if (!empty ($data_single)) {
|
||||||
$data = array_merge ($data, $data_single);
|
$data = array_merge ($data, $data_single);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user