Merge branch 'ent-7443-Metaconsola-Nodo-Dashboard-Top-N-events-de-todos-ninguno-saca-informacion' into 'develop'
fixed top n widgets in meta See merge request artica/pandorafms!4255
This commit is contained in:
commit
3e1208d5b2
|
@ -414,10 +414,32 @@ class TopNWidget extends Widget
|
||||||
$quantity
|
$quantity
|
||||||
);
|
);
|
||||||
|
|
||||||
$modules = @db_get_all_rows_sql(
|
if (is_metaconsole() === true) {
|
||||||
$sql,
|
$servers = metaconsole_get_servers();
|
||||||
$search_in_history_db
|
|
||||||
);
|
$modules = [];
|
||||||
|
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
if (metaconsole_connect(null, $server['id']) !== NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules = array_merge(
|
||||||
|
$modules,
|
||||||
|
@db_get_all_rows_sql(
|
||||||
|
$sql,
|
||||||
|
$search_in_history_db
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$modules = @db_get_all_rows_sql(
|
||||||
|
$sql,
|
||||||
|
$search_in_history_db
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($modules) === true) {
|
if (empty($modules) === true) {
|
||||||
$output .= '<div class="container-center">';
|
$output .= '<div class="container-center">';
|
||||||
|
|
|
@ -367,6 +367,8 @@ class TopNEventByGroupWidget extends Widget
|
||||||
|
|
||||||
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
||||||
|
|
||||||
|
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
|
||||||
|
|
||||||
if (empty($this->values['groupId']) === true) {
|
if (empty($this->values['groupId']) === true) {
|
||||||
$output .= '<div class="container-center">';
|
$output .= '<div class="container-center">';
|
||||||
$output .= \ui_print_info_message(
|
$output .= \ui_print_info_message(
|
||||||
|
@ -388,12 +390,13 @@ class TopNEventByGroupWidget extends Widget
|
||||||
if ($all_group === false) {
|
if ($all_group === false) {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_agente, COUNT(*) AS count
|
'SELECT id_agente, COUNT(*) AS count
|
||||||
FROM tevento
|
FROM %s
|
||||||
WHERE utimestamp >= %d
|
WHERE utimestamp >= %d
|
||||||
AND id_grupo IN (%s)
|
AND id_grupo IN (%s)
|
||||||
GROUP BY id_agente
|
GROUP BY id_agente
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
|
$event_table,
|
||||||
$timestamp,
|
$timestamp,
|
||||||
implode(',', $this->values['groupId']),
|
implode(',', $this->values['groupId']),
|
||||||
$this->values['amountShow']
|
$this->values['amountShow']
|
||||||
|
@ -401,11 +404,12 @@ class TopNEventByGroupWidget extends Widget
|
||||||
} else {
|
} else {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_agente, COUNT(*) AS count
|
'SELECT id_agente, COUNT(*) AS count
|
||||||
FROM tevento
|
FROM %s
|
||||||
WHERE utimestamp >= %d
|
WHERE utimestamp >= %d
|
||||||
GROUP BY id_agente
|
GROUP BY id_agente
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
|
$event_table,
|
||||||
$timestamp,
|
$timestamp,
|
||||||
$this->values['amountShow']
|
$this->values['amountShow']
|
||||||
);
|
);
|
||||||
|
@ -428,9 +432,18 @@ class TopNEventByGroupWidget extends Widget
|
||||||
if ($row['id_agente'] == 0) {
|
if ($row['id_agente'] == 0) {
|
||||||
$name = __('System');
|
$name = __('System');
|
||||||
} else {
|
} else {
|
||||||
$name = io_safe_output(
|
if (is_metaconsole() === true) {
|
||||||
agents_get_alias($row['id_agente'])
|
$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'].')';
|
$name .= ' ('.$row['count'].')';
|
||||||
|
|
|
@ -365,6 +365,8 @@ class TopNEventByModuleWidget extends Widget
|
||||||
|
|
||||||
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
||||||
|
|
||||||
|
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
|
||||||
|
|
||||||
if (empty($this->values['groupId']) === true) {
|
if (empty($this->values['groupId']) === true) {
|
||||||
$output = '<div class="container-center">';
|
$output = '<div class="container-center">';
|
||||||
$output .= \ui_print_info_message(
|
$output .= \ui_print_info_message(
|
||||||
|
@ -389,12 +391,13 @@ class TopNEventByModuleWidget extends Widget
|
||||||
id_agentmodule,
|
id_agentmodule,
|
||||||
event_type,
|
event_type,
|
||||||
COUNT(*) AS count
|
COUNT(*) AS count
|
||||||
FROM tevento
|
FROM %s
|
||||||
WHERE utimestamp >= %d
|
WHERE utimestamp >= %d
|
||||||
AND id_grupo IN (%s)
|
AND id_grupo IN (%s)
|
||||||
GROUP BY id_agentmodule, event_type
|
GROUP BY id_agentmodule, event_type
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
|
$event_table,
|
||||||
$timestamp,
|
$timestamp,
|
||||||
implode(',', $this->values['groupId']),
|
implode(',', $this->values['groupId']),
|
||||||
$this->values['amountShow']
|
$this->values['amountShow']
|
||||||
|
@ -405,11 +408,12 @@ class TopNEventByModuleWidget extends Widget
|
||||||
id_agentmodule,
|
id_agentmodule,
|
||||||
event_type,
|
event_type,
|
||||||
COUNT(*) AS count
|
COUNT(*) AS count
|
||||||
FROM tevento
|
FROM %s
|
||||||
WHERE utimestamp >= %d
|
WHERE utimestamp >= %d
|
||||||
GROUP BY id_agentmodule, event_type
|
GROUP BY id_agentmodule, event_type
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
|
$event_table,
|
||||||
$timestamp,
|
$timestamp,
|
||||||
$this->values['amountShow']
|
$this->values['amountShow']
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue