Running Monit 5.2.5 on Fedora 15

All standard alerts are working, however just cannot get exec to run anything.

I have tried more than ten different configurations based on examples from the Monit Wiki. None of the exec commands do anything. Below is just one simple examples in an attempt to get 'something' working:

check process tomcat6 with pidfile /var/run/tomcat6.pid
    start program = "/etc/init.d/tomcat6 start"
    stop program = "/etc/init.d/tomcat6 stop"
    if failed host localhost port 8080 then
        exec "/bin/bash -c '/bin/touch /tmp/monittest'"

If I shutdown Tomcat an alert is sent and the service restarts. However whatever I try in exec is always ignored.

I understand that Monit is very restrictive in terms of its environment and is limited to directories such as /bin and/sbin/. Therefore all the example I have tried have been restricted to these directories. But still nothing.

Anyone any ideas?

p.s. I have turned on verbose logging and no clues in the log file.

  • Is selinux enabled? May 29 '12 at 9:48

Not sure if the connectivity test is done during service restart, maybe try something like this first:

check process tomcat6 with pidfile /var/run/tomcat6.pid
    if changed pid then exec "/bin/bash -c '/bin/touch /tmp/monittest'"
  • Good suggestion. I tried but no luck. Absolutely no suggestion in the verbose logs that the exec is even attempted. I think my next attempt may be to try a different version of monit on an older Fedora and see if it is related to the version. Nov 1 '11 at 1:25

Your test works for me on Debian 6.0.4 with Monit 5.3.2 compiled from source.

Please try changing the port to an invalid value, like 8888 or 65432, and see if the file is created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.