Eric, your reply gave me an idea that I seems to be working. I split my check so that I have a status check for apache and one that only deals with starting/stopping ospf. While I think it's ugly, it appears to do the right thing.
# Special check to shut down ospfd if apache down check process apache_ospf with pidfile /var/run/httpd.pid if does not exist then exec "/bin/bash -c 'if [ ! -f /tmp/monit.apachedown ]; then touch /tmp/monit.apachedown; /usr/bin/monit stop ospfd; fi'" else if recovered then exec "/bin/bash -c 'rm /tmp/monit.apachedown && /usr/bin/monit monitor ospfd'" group ospf depends on apache check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if failed host localhost port 80 protocol http and request "/" then restart if children > 50 then restart if 2 restarts within 2 cycles then timeout group server I still need to run a few tests to make sure this catches all of the possible failures, but so far so good! It's still a bit chattier than I would like, but that's because I have a "monit monitor server" in my ospfd start script to make sure it can't get started w/o everything else running. Thanks everyone for the replies, and I look forward to a day when dependencies are "hard" so I can get rid of all of my crufty configs! :) On 14.12.2011 10:18, Eric Pailleau wrote: > Hi, > I mean you may split socket and pidfile monitoring in two parts : > > check host apache_80 with address 127.0.0.1 > start program = "/etc/init.d/httpd start" > stop program = "/etc/init.d/httpd stop" > if failed port 80 protocol http with timeout 30 seconds then restart > if 2 restarts within 2 cycles then timeout > > check process apache_pid with pidfile /var/run/httpd.pid > blahblah ... > > Regards. > > Le 14/12/2011 19:01, Daniel Rich a écrit : > >> That's already in there -- that's what is bothering me. I have the port 80 check on localhost that is supposed to trigger a restart but it isn't triggering. If that doesn't trigger then neither will the "if 2 restarts within 2 cycles" block. I even tried changing the order by moving the localhost port 80 check before the "does not exist" check, but that makes no difference. check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if does not exist then exec "/bin/bash -c 'if [ ! -f /tmp/monit.apachedown ]; then touch /tmp/monit.apachedown; /usr/bin/monit stop ospfd; fi'" else if recovered then exec "/bin/bash -c 'rm /tmp/monit.apachedown&& /usr/bin/monit monitor ospfd'" if failed host localhost port 80 protocol http and request "/" then restart if children> 50 then restart if 2 restarts within 2 cycles then timeout group server depends on tomcat On Dec 14, 2011, at 00:30, Eric Pailleau wrote: >> >>> Hello, In addition to pidfile check, you may add a tcp 80 (or another depending what apache is binding) check, or better a http page check (check host not in the pidfile paragraph). This will better check that your apache is up and running. This way you can do a simple apache restart on the second check ? But be carefull on dependencies. regards. -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general [1] >> Dan Rich | http://www.employees.org/~drich/ [3] | "Step up to red alert!" "Are you sure, sir? | It means changing the bulb in the sign..." | - Red Dwarf (BBC) -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general [4] > > -- Salutations - Best regards - mit freundlichen Grüssen ----------------- [email protected] [5] ------------------------------------ fr - Merci d'utiliser cette addresse pour le support ou question technique en - Please use this address for any support or technical question ----------------- https://support.numlog.fr [6] -------------------------------- fr - Privilégier la gestion de ticket d'incident (Clients NUMLOG) en - Prefere our trouble ticket application (NUMLOG's customers) -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general [7] -- Dan Rich http://www.employees.org/~drich/ [8] "Step up to red alert!" "Are you sure, sir? It means changing the bulb in the sign..." - Red Dwarf (BBC) Links: ------ [1] https://lists.nongnu.org/mailman/listinfo/monit-general [2] mailto:[email protected] [3] http://www.employees.org/~drich/ [4] https://lists.nongnu.org/mailman/listinfo/monit-general [5] mailto:[email protected] [6] https://support.numlog.fr [7] https://lists.nongnu.org/mailman/listinfo/monit-general [8] http://www.employees.org/%7Edrich/
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
