Debugging monit

后端 未结 7 2045
迷失自我
迷失自我 2020-12-07 09:04

I find debugging monit to be a major pain. Monit\'s shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that

7条回答
  •  广开言路
    2020-12-07 09:32

    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.

    I hope that helps.

提交回复
热议问题