mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge branch 'ent-13212-error-calculo-modulos-agente-visto-fenix' into 'develop'
Ent 13212 error calculo modulos agente visto fenix See merge request artica/pandorafms!7130
This commit is contained in:
commit
55d97b7556
@ -3325,27 +3325,34 @@ class ConsoleSupervisor
|
|||||||
public function checkTotalModulesByAgent()
|
public function checkTotalModulesByAgent()
|
||||||
{
|
{
|
||||||
$modules_by_agent = db_process_sql(
|
$modules_by_agent = db_process_sql(
|
||||||
'SELECT count(*) AS modules_by_agent
|
'SELECT count(*) AS count
|
||||||
FROM tagente a
|
FROM tagente a
|
||||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||||
|
WHERE m.disabled = 0
|
||||||
GROUP BY m.id_agente'
|
GROUP BY m.id_agente'
|
||||||
);
|
);
|
||||||
|
|
||||||
$show_warning = false;
|
$show_warning = false;
|
||||||
foreach ($modules_by_agent as $key => $total_modules) {
|
|
||||||
if ($total_modules['modules_by_agent'] > 200) {
|
if ($modules_by_agent !== false) {
|
||||||
$this->notify(
|
$agents = count($modules_by_agent);
|
||||||
[
|
$modules = array_sum(array_column($modules_by_agent, 'count'));
|
||||||
'type' => 'NOTIF.MODULES_AGENT.ALERT',
|
|
||||||
'title' => __('Your system has an average of %s modules per agent', $total_modules['modules_by_agent']),
|
$ratio = ($modules / $agents);
|
||||||
'message' => __('This is higher than the recommended maximum (200). This may result in poor performance of your system.'),
|
$ratio = round($ratio, 2);
|
||||||
'icon_notification' => self::ICON_HEADSUP,
|
}
|
||||||
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
|
||||||
]
|
if ($ratio > 200) {
|
||||||
);
|
$this->notify(
|
||||||
$show_warning = true;
|
[
|
||||||
break;
|
'type' => 'NOTIF.MODULES_AGENT.ALERT',
|
||||||
}
|
'title' => __('Your system has an average of %s modules per agent', $ratio),
|
||||||
|
'message' => __('This is higher than the recommended maximum (200). This may result in poor performance of your system.'),
|
||||||
|
'icon_notification' => self::ICON_HEADSUP,
|
||||||
|
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$show_warning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_warning === false) {
|
if ($show_warning === false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user