I'm having trouble with monit. I have setup monitoring with monit. However, I'm having trouble with a check for the process running. If the process is not running, i want to run an specific script that will create a pagerduty alert.
My Monit file looks like this:
check process "myapp" matching "myapp" start program = "/usr/local/myapp start" stop program = "/usr/local/myapp stop" if does not exist then exec "/bin/bash pagerduty_script 'MyApp Down' trigger"
pagerduty_script is just a wrapper that takes two arguments
"string event" and action
The script works. I've tested in terminal and it runs fine. events are actually created in pagerduty. However, it doesn't seem like monit is actually running it even though no process is running:
ps -ef | grep myapp vagrant 23950 23136 0 17:40 pts/0 00:00:00 grep --color=auto myapp
sudo monit status:
Process 'myapp' status Execution failed monitoring status Monitored data collected Tue, 16 Sep 2014 17:40:11
I don't understand why it works on the console, but monit doesn't actually generate the event. Any help would be greatly appreciated!