Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Is selinux enabled? –  utopiabound May 29 '12 at 9:48

2 Answers 2

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'"
share|improve this answer
    
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. –  interoperate 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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