1

I have a hard time getting monit to work on my Ubuntu 18.04.4.

I've installed monit via sudo apt install monit, then I've enabled httpd like this:

set httpd port 2812 and
    use address localhost
    allow localhost
    allow admin:monit

This is basically the default configuration of monit. Then I restarted monit via sudo systemctl restart monit.

If I take a look at its log file at /var/log/monit.log, I can see that the monit web server should be running:

Starting Monit 5.25.1 daemon with http interface at [localhost]:2812

On the server, I have ufw running, output of sudo ufw status verbose:

root@v22017062828950292:~# sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
2812/tcp                   ALLOW IN    Anywhere
22/tcp                     ALLOW IN    Anywhere
8080/tcp                   ALLOW IN    Anywhere
127.0.0.1 2812/tcp         ALLOW IN    127.0.0.1
127.0.0.1 80/tcp           ALLOW IN    127.0.0.1
2812/tcp (v6)              ALLOW IN    Anywhere (v6)
22/tcp (v6)                ALLOW IN    Anywhere (v6)
8080/tcp (v6)              ALLOW IN    Anywhere (v6)

However, if I execute monit status, I get:

Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect.

I've tried binding monit to 0.0.0.0 like this:

set httpd port 2812 and
    use address 0.0.0.0
    allow 0.0.0.0/0.0.0.0
    allow admin:monit

Then I can connect via browser and the IP of my server to the Web Interface, but monit status still outputs, that the http interface is not enabled.

I'm currently running out of ideas, since with the last configuration I can clearly reach the web interface from my browser but not via the command line interface.

I also tried disabled ufw with sudo ufw disable, resulting in the same problem, that the CLI can not connect to the web interface.

Do you have any more idea, what could be wrong?

1 Answers1

0

What happens of you do sudo monit status? Where did you put your configuration at?

The monit client must be able to read the configuration to run the status command. It needs to know the port and username/password to connect. If you properly secured your config with the password, it would only be readable by root.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • 1
    Same message for `sudo monit status`. The configuration file is the default location at `/etc/monit/monitrc`. Also, monit is using that configuration file, as stated above, because I can make it work browser access, but not CLI access. So the config is readable. – Manuel Rauber Jun 16 '20 at 20:33