Fixed bug in some items of reports in metaconsole

This commit is contained in:
Tatiana Llorente 2019-11-11 17:58:00 +01:00
parent 7d45cad637
commit 1b3c7f8ed6

View File

@ -885,6 +885,10 @@ function reporting_SLA(
$edge_interval = 10;
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$slas = db_get_all_rows_field_filter(
'treport_content_sla_combined',
'id_report_content',
@ -1389,6 +1393,10 @@ function reporting_event_top_n(
$return['top_n'] = $content['top_n_value'];
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
// Get all the related data.
$sql = sprintf(
'SELECT id_agent_module, server_name
@ -2412,6 +2420,9 @@ function reporting_exception(
WHERE id_report_content = %d',
$content['id_rc']
);
if (is_metaconsole()) {
metaconsole_restore_db();
}
$exceptions = db_process_sql($sql);
} else {
@ -3462,6 +3473,7 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
$return['data'] = [];
if (is_metaconsole()) {
metaconsole_restore_db();
$server_names = metaconsole_get_connection_names();
if (isset($server_names) && is_array($server_names)) {
foreach ($server_names as $key => $value) {
@ -5058,6 +5070,10 @@ function reporting_sql($report, $content)
$historical_db = $content['historical_db'];
}
if (is_metaconsole()) {
metaconsole_restore_db();
}
$result = db_get_all_rows_sql($sql, $historical_db);
if ($result !== false) {
foreach ($result as $row) {
@ -6147,6 +6163,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$sql = sprintf(
'
SELECT id_agent_module,
@ -6416,6 +6436,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
$edge_interval = 10;
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$slas = io_safe_output(
db_get_all_rows_field_filter(
'treport_content_sla_combined',
@ -7018,6 +7042,7 @@ function reporting_increment($report, $content)
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
$sql2 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC';
metaconsole_restore_db();
$servers = db_get_all_rows_sql(
'SELECT *
FROM tmetaconsole_setup
@ -7121,6 +7146,10 @@ function reporting_general($report, $content)
$return['show_in_same_row'] = $content['style']['show_in_same_row'];
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$generals = db_get_all_rows_filter(
'treport_content_item',
['id_report_content' => $content['id_rc']]