From a9832e9886b9bbff50c51021b0fe1d44c721ae7e Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 13 Feb 2023 15:40:55 +0100 Subject: [PATCH] WIP: Added pandora notification if missing library on agent --- .../include/class/ConsoleSupervisor.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index b6a6d3df43..17d7b2213a 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -518,6 +518,14 @@ class ConsoleSupervisor $this->checkSyncQueueLength(); $this->checkSyncQueueStatus(); } + + /* + * Checkc agent missing libraries. + * NOTIF.AGENT.LIBRARY + */ + if ((bool) enterprise_installed() === true) { + $this->checkLibaryError(); + } } @@ -2806,4 +2814,29 @@ class ConsoleSupervisor } + /** + * Chechs if an agent has a dependency eror on omnishell + * + * @return void + */ + public function checkLibaryError() + { + $sql = 'SELECT COUNT(errorlevel) from tremote_command_target WHERE errorlevel = 2'; + + $error_dependecies = db_get_sql($sql); + if ($error_dependecies > 0) { + $this->notify( + [ + 'type' => 'NOTIF.AGENT.LIBRARY', + 'title' => __('Agent dependency error'), + 'message' => __( + 'There are omnishell agents with dependency errors', + ), + 'url' => $url, + ] + ); + } + } + + }