Is it possible to redirect the output of an exec command to the monit log?
check host example.org with address example.org
if failed port 80 protocol http for 2 cycles then
exec "/root/cloudflare.py >> /var/log/monit.log"
This doesn't seem to work:
[EST Mar 6 16:02:19] error : 'example.org' failed, cannot open a connection to INET[example.org:80] via TCP
[EST Mar 6 16:02:24] info : 'example.org' exec: /root/cloudflare.py
[EST Mar 6 16:02:24] error : 'nginx' process is not running
[EST Mar 6 16:02:24] info : 'nginx' trying to restart
[EST Mar 6 16:02:24] info : 'nginx' start: /etc/init.d/nginx
[EST Mar 6 16:02:24] error : monit: Error reading pid from file '/var/run/nginx.pid'
As you can see it records that it invoked the script, and the script does actually do what it is expected to do, but the directed output is not captured in the log. It does, of course, if I run from the cmdline.
Is there a problem with two processes trying to append to the same log? or is this too much for a monit exec?