monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [monit] Monit believes web service is up even when it is not


From: Balcoes
Subject: RE: [monit] Monit believes web service is up even when it is not
Date: Sun, 8 Nov 2009 11:44:31 +0200

Hi

 

Monit waits for process to stop when "check process" is used (since it knows the PID in such case, it will wait for process to stop).

 

In the case of "check host" it cannot detect whether the process stopped or not, since it is configured to test via network only. When restart action is triggered, it thus calls stop program immediately followed by start program.

 

If you want to call restart only, you can set it this way:

 

--8<--

  if failed host 192.168.1.10 port 80 protocol http for 5 times then exec "/etc/init.d/domino restart"

--8<--

 

Thank you for the tip. I also noticed that Monit needs to know the PID (to wait for the stop script to end) so to create the PID file I modified the Domino startup script in a quick and dirty way as follows:

    su - ${DOMINO_USER} -c "cd ${DOMINO_DATA_DIR}; cat ${SERVER_PASSWD_FILE} | ${DOMINO_BIN_DIR}/server"  >> $DOMINO_LOG_FILE 2>&1 &

    sleep 5s                         # Just in case...

    ps U ${DOMINO_USER}|grep ${SERVER_PASSWD_FILE}|head -n 1|awk '{print $1}' > ${DOMINO_PID_FILE}

 

I.e. the first line was in the original startup script. After starting the server there’s a 5 second delay. Whether it is needed or not is still unclear.

 

After the delay the last line searches for the PID and writes it to the PID file. I had to use this somewhat unelegant approach as the server is started with ‘su’, so $! Doesn’t seem to return the right PID.

 

 

B

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]