Linux – monit configuration under CentOS

centoslinuxmonit

I am trying to do the following:

monit stop mysqld
monit: Cannot connect to the monit daemon. Did you start it with http support?

it only works when I stop the monit service.

Do you have any suggestions?

Best Answer

Make sure you have embedded web server enabled. This monit stop ... command uses it internally.

# Monit has an embedded web server which can be used to view status of 
# services monitored and manage services from a web interface. See the
# Monit Wiki if you want to enable SSL for the web server. 

set httpd port 2812 and
    use address localhost  # only accept connection from localhost
    allow localhost        # allow localhost to connect to the server and
    allow admin:monit      # require user 'admin' with password 'monit'

Do change password if you omit this "use address localhost" line.