mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Added functions in modules to get table of data and raw data.
(cherry picked from commit 2f98c1fc863a1ed4ff6a350be0cc84ba16064667)
This commit is contained in:
parent
079f81e62a
commit
4d62e41d24
@ -762,6 +762,56 @@ function modules_get_agentmodule ($id_agentmodule) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modules_get_table_data($id_agent_module) {
|
||||||
|
$id_type = db_get_value('id_tipo_modulo',
|
||||||
|
'tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
||||||
|
|
||||||
|
$name_type = db_get_value('nombre', 'ttipo_modulo', 'id_tipo', $id_type);
|
||||||
|
|
||||||
|
$chunks = explode('_', $name_type);
|
||||||
|
$subtype = end($chunks);
|
||||||
|
|
||||||
|
|
||||||
|
switch ($subtype) {
|
||||||
|
case 'data':
|
||||||
|
case 'proc':
|
||||||
|
case 'icmp':
|
||||||
|
case 'tcp':
|
||||||
|
case 'snmp':
|
||||||
|
case 'inc':
|
||||||
|
// Numeric
|
||||||
|
return "tagente_datos";
|
||||||
|
break;
|
||||||
|
case 'log4x':
|
||||||
|
// Log4x
|
||||||
|
return "tagente_datos_log4x";
|
||||||
|
break;
|
||||||
|
case 'string':
|
||||||
|
// String
|
||||||
|
return "tagente_datos_string";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function modules_get_raw_data($id_agent_module, $date_init, $date_end) {
|
||||||
|
$table = modules_get_table_data($id_agent_module);
|
||||||
|
|
||||||
|
$datelimit = $date_init - $date_end;
|
||||||
|
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||||
|
|
||||||
|
$data = db_get_all_rows_sql('
|
||||||
|
SELECT *
|
||||||
|
FROM ' . $table . '
|
||||||
|
WHERE id_agente_modulo = ' . $id_agent_module . '
|
||||||
|
AND utimestamp >= ' . $date_init . '
|
||||||
|
AND utimestamp <= ' . $date_end, $search_in_history_db);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
function modules_get_agent_group($id_agent_module) {
|
function modules_get_agent_group($id_agent_module) {
|
||||||
$return = false;
|
$return = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user