5

Monit seems to be working, but when I go to the web interface at port :2812 I get

-->:/var/log$ sudo monit -t
Control file syntax OK
-->:/var/log$ sudo monit status
The Monit daemon 5.2.5 uptime: 11m 

System 'system_mydomain.net'
  status                            running
  monitoring status                 monitored
  load average                      [0.00] [0.01] [0.05]
  cpu                               0.0%us 0.0%sy 0.0%wa
  memory usage                      645520 kB [63.4%]
  swap usage                        213128 kB [10.1%]
  data collected                    Wed Feb 15 06:27:26 2012

Any ideas what would cause this?

99miles
  • 10,942
  • 18
  • 78
  • 123

3 Answers3

3

I couldn't get this working so that all external IPs could access the web interface.

In the end I used Apache:

<VirtualHost *:80>
    ServerName monit.yourdomain.com
    ProxyPass / http://localhost:2812/
    ProxyPassReverse / http://localhost:2813/
    ProxyPreserveHost On
    <Proxy>
        Order allow,deny
        Allow from all
    </Proxy>
</VirtualHost>

You need the proxy and proxy_http mods enabled for this to work.

JonB
  • 1,320
  • 2
  • 15
  • 30
3

Probably your configuration is SSL enabled but you have not generated the private certificate for HTTPS.

If you do not care about security in your context, open /etc/monit/monitrc and replace the existing httpd section with

set httpd port 2812 and
   allow localhost
   allow admin:test

After a monit deamon restart, you should be able to connect to http://localhost:2812/ with admin user and password test.

To allow access from anywhere, you have to use allow 0.0.0.0/0.0.0.0

Please refer to monit httpd documentation section for full details.

If you want SSL enabled, you will have to generate a SSL self-signed certificate at /etc/certs/monit.pem thanks to the following procedure, for instance.

Yves Martin
  • 10,217
  • 2
  • 38
  • 77
  • I can't seem to access the web interface till I specify my external IP. Is there a way to allow the web interface to be available to all external IPs? Tried removing the 'allow localhost' condition, but it still didn't work. – Abhic Apr 29 '12 at 23:53
  • 1
    According to documentation, you should use allow 0.0.0.0/32 – Yves Martin May 01 '12 at 07:58
  • 2
    Tried it. Didn't work. Just tried it again to double check. Only working when I hardcode my current IP. – Abhic May 04 '12 at 15:24
  • 2
    @Abhic - did you ever get this working? I'm getting the same problem. – JonB Oct 07 '12 at 18:29
  • @JonB Nope I didn't. Will be revisiting this sometime in 2 weeks. Will update this ticket then. – Abhic Oct 21 '12 at 12:33
  • I can confirm what @Abhic mentions - I can only access monit externally when I specify the address of my remote system in the monit config – dtmland Aug 21 '15 at 14:46
  • 1
    UPDATE: This line allows access for all external servers : allow 0.0.0.0/0.0.0.0 – dtmland Aug 21 '15 at 14:55
0

Remove the line 'allow localhost' from the configuration and restart monit

PJ.
  • 1,196
  • 2
  • 12
  • 25