Last value report meta with date before

This commit is contained in:
Calvo 2022-01-31 19:27:27 +01:00
parent 615304712f
commit 83d490df5d
1 changed files with 13 additions and 14 deletions

View File

@ -4087,22 +4087,25 @@ function reporting_last_value($report, $content, $datetime, $period)
{
global $config;
$module = new Module($content['id_agent_module']);
try {
$id_meta = null;
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
}
$module = new Module($content['id_agent_module'], false, $server['id']);
} catch (\Exception $e) {
$result = [];
return reporting_check_structure_content($result);
}
$return['type'] = 'last_value';
if (empty($content['name'])) {
$content['name'] = __('Last Value');
}
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
if (metaconsole_connect($server) != NOERR) {
$result = [];
return reporting_check_structure_content($result);
}
}
$id_agent = $module->agent()->id_agente();
$id_agent_module = $content['id_agent_module'];
$agent_alias = $module->agent()->alias();
@ -4189,10 +4192,6 @@ function reporting_last_value($report, $content, $datetime, $period)
$return['data'] = $result;
if (is_metaconsole()) {
metaconsole_restore_db();
}
return reporting_check_structure_content($return);
}