Debugging monit

I’ve had the same problem. Using monit’s verbose command-line option helps a bit, but I found the best way was to create an environment as similar as possible to the monit environment and run the start/stop program from there.

# monit runs as superuser
$ sudo su

# the -i option ignores the inherited environment
# this PATH is what monit supplies by default
$ env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/sh

# try running start/stop program here

I’ve found the most common problems are environment variable related (especially PATH) or permission-related. You should remember that monit usually runs as root.

Also if you use as uid myusername in your monit config, then you should change to user myusername before carrying out the test.

Leave a Comment