diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index e4675ccd49..f1ba2b268f 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,12 @@ +2009-10-16 Sancho Lerena + + * lib/PandoraFMS/Core.pm: Keepalive was not working properly. Keepalive + moduletype is now managed like a proc (0 = BAD) in get_status function. + + * util/pandora_server: Start/Stop daemon now works and problem has been + fixed, and I'm very happy after so many days trying to figure what the + hell was happening here. + 2009-10-15 Sancho lerena * lib/PandoraFMS/SNMPServer.pm: Fixed small problem in snmp2agent diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 96da669400..0f0a223210 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -836,7 +836,7 @@ sub pandora_module_keep_alive_nd { AND ( tagente_estado.utimestamp + (tagente.intervalo * 2) < UNIX_TIMESTAMP())'); foreach my $module (@modules) { - pandora_process_module ($pa_config, 1, '', $module, 'keep_alive', '', time (), 0, $dbh); + pandora_process_module ($pa_config, 0, '', $module, 'keep_alive', '', time (), 0, $dbh); } } @@ -1080,6 +1080,10 @@ sub get_module_status ($$) { ($critical_min, $critical_max) = (0, 1); } + if ($module_type =~ m/keep_alive/ && ($critical_min eq $critical_max)) { + ($critical_min, $critical_max) = (0, 1); + } + # Critical if ($critical_min ne $critical_max) { return 1 if ($data >= $critical_min && $data < $critical_max); diff --git a/pandora_server/util/pandora_server b/pandora_server/util/pandora_server index 52a8ffffa0..75aa4b6a99 100755 --- a/pandora_server/util/pandora_server +++ b/pandora_server/util/pandora_server @@ -39,7 +39,11 @@ fi # This function replace pidof, not working in the same way in different linux distros function pidof_pandora () ( - PANDORA_PID=`ps -Af | grep "$PANDORA_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'` + # This sets COLUMNS to 200 chars, because if command is run + # in a "strech" term, ps aux don't report more than COLUMNS + # characters and this will not work. + COLUMNS=200 + PANDORA_PID=`ps aux | grep "$PANDORA_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'` echo $PANDORA_PID ) @@ -99,6 +103,11 @@ case "$1" in COUNTER=`expr $COUNTER + 1` sleep 1 done + + # Send a KILL -9 signal to process, if it's alive after 60secs, we need + # to be sure is really dead, and not pretending... + + kill -9 $PANDORA_PID > /dev/null 2>&1 rc_status -v fi