';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
index aa4f64ca79..42cd059dc5 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
@@ -367,6 +367,8 @@ class TopNEventByGroupWidget extends Widget
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
+ $event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
+
if (empty($this->values['groupId']) === true) {
$output .= '
';
$output .= \ui_print_info_message(
@@ -388,12 +390,13 @@ class TopNEventByGroupWidget extends Widget
if ($all_group === false) {
$sql = sprintf(
'SELECT id_agente, COUNT(*) AS count
- FROM tevento
+ FROM %s
WHERE utimestamp >= %d
AND id_grupo IN (%s)
GROUP BY id_agente
ORDER BY count DESC
LIMIT %d',
+ $event_table,
$timestamp,
implode(',', $this->values['groupId']),
$this->values['amountShow']
@@ -401,11 +404,12 @@ class TopNEventByGroupWidget extends Widget
} else {
$sql = sprintf(
'SELECT id_agente, COUNT(*) AS count
- FROM tevento
+ FROM %s
WHERE utimestamp >= %d
GROUP BY id_agente
ORDER BY count DESC
LIMIT %d',
+ $event_table,
$timestamp,
$this->values['amountShow']
);
@@ -428,9 +432,18 @@ class TopNEventByGroupWidget extends Widget
if ($row['id_agente'] == 0) {
$name = __('System');
} else {
- $name = io_safe_output(
- agents_get_alias($row['id_agente'])
- );
+ if (is_metaconsole() === true) {
+ $name = (string) db_get_value(
+ 'alias',
+ 'tmetaconsole_agent',
+ 'id_tagente',
+ (int) $row['id_agente']
+ );
+ } else {
+ $name = io_safe_output(
+ agents_get_alias($row['id_agente'])
+ );
+ }
}
$name .= ' ('.$row['count'].')';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
index f110c4ea52..0d413d219c 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
@@ -365,6 +365,8 @@ class TopNEventByModuleWidget extends Widget
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
+ $event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
+
if (empty($this->values['groupId']) === true) {
$output = '
';
$output .= \ui_print_info_message(
@@ -389,12 +391,13 @@ class TopNEventByModuleWidget extends Widget
id_agentmodule,
event_type,
COUNT(*) AS count
- FROM tevento
+ FROM %s
WHERE utimestamp >= %d
AND id_grupo IN (%s)
GROUP BY id_agentmodule, event_type
ORDER BY count DESC
LIMIT %d',
+ $event_table,
$timestamp,
implode(',', $this->values['groupId']),
$this->values['amountShow']
@@ -405,11 +408,12 @@ class TopNEventByModuleWidget extends Widget
id_agentmodule,
event_type,
COUNT(*) AS count
- FROM tevento
+ FROM %s
WHERE utimestamp >= %d
GROUP BY id_agentmodule, event_type
ORDER BY count DESC
LIMIT %d',
+ $event_table,
$timestamp,
$this->values['amountShow']
);