allow disable counters on mc environments

This commit is contained in:
fbsanchez 2022-04-11 14:20:17 +02:00
parent 773071946f
commit 8a221f10b0
2 changed files with 61 additions and 47 deletions

View File

@ -530,6 +530,20 @@ class TreeService extends Tree
$tmp['elementDescription'] = $item->description(); $tmp['elementDescription'] = $item->description();
$tmp['disabled'] = $item->service()->disabled(); $tmp['disabled'] = $item->service()->disabled();
$counters = [
'total_modules' => 0,
'total_agents' => 0,
'total_services' => 0,
'total_dynamic' => 0,
'total' => 0,
];
if (is_metaconsole() === false
|| (isset($config['realtimestats']) === true
&& $config['realtimestats'] === true
&& $tmp['metaID'] > 0)
) {
// Look for counters.
if ($this->connectedToNode === false if ($this->connectedToNode === false
&& is_metaconsole() === true && is_metaconsole() === true
&& $tmp['metaID'] > 0 && $tmp['metaID'] > 0
@ -557,14 +571,6 @@ class TreeService extends Tree
\enterprise_hook('metaconsole_restore_db'); \enterprise_hook('metaconsole_restore_db');
} }
$counters = [
'total_modules' => 0,
'total_agents' => 0,
'total_services' => 0,
'total_dynamic' => 0,
'total' => 0,
];
if (is_array($grandchildren) === true) { if (is_array($grandchildren) === true) {
$counters = array_reduce( $counters = array_reduce(
$grandchildren, $grandchildren,
@ -590,6 +596,10 @@ class TreeService extends Tree
if ($counters['total'] > 0) { if ($counters['total'] > 0) {
$tmp['searchChildren'] = 1; $tmp['searchChildren'] = 1;
} }
} else {
// Always search for.
$tmp['searchChildren'] = 1;
}
$tmp['type'] = 'services'; $tmp['type'] = 'services';
$tmp['rootType'] = 'services'; $tmp['rootType'] = 'services';

View File

@ -2060,6 +2060,10 @@ function config_process_config()
config_update_value('metaconsole_events_history', 0); config_update_value('metaconsole_events_history', 0);
} }
if (!isset($config['realtimestats'])) {
config_update_value('realtimestats', 1);
}
if (!isset($config['trap_purge'])) { if (!isset($config['trap_purge'])) {
config_update_value('trap_purge', 7); config_update_value('trap_purge', 7);
} }