From 4954f761d613c7727092419eadb04ab7515aee76 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 29 Aug 2023 15:42:15 +0200 Subject: [PATCH] Fix get agent status for agent with only noninit modules --- pandora_server/lib/PandoraFMS/DB.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index a5a6d98b80..f9be30bd41 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -686,9 +686,9 @@ sub get_agent_status ($$$) { if ($modules_async < $count_modules) { my $last_contact = get_db_value($dbh, 'SELECT (UNIX_TIMESTAMP(ultimo_contacto) + (intervalo * 2)) AS last_contact - FROM tagente WHERE id_agente = ?', $agent_id); + FROM tagente WHERE id_agente = ? AND UNIX_TIMESTAMP(ultimo_contacto) > 0', $agent_id); - if ($last_contact < time ()) { + if (defined($last_contact) && $last_contact < time ()) { return 3; } }