Setup monit behind Apache proxy under ISPConfig

Today I wanted to setup monit behind Apache proxy on my webserver, which runs ISPConfig (https://www.ispconfig.org/) under Debian. Monit is a OpenSource monitoring tool for Linux (see https://mmonit.com/monit/).

Requirements

I had the following requirements on the solution:

  • monit should only be accessible from the server itself (localhost)
  • monit should run under a special SSL-secured URL (not IP:PORT as in default)
  • monit should run password protected

Software Versions

  • Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux
  • ISPConfig 1.3.2
  • Apache 2.4.10 (Debian)
  • Monit version 5.20.0

Steps to setup monit behind Apache proxy

  1. First I had to login as root. But sudo-ing with a sudoers user should work as well.
  2. Install monit:
  3. Add a new config file under /etc/monit/conf.d/ask-sheldon.cfg with the following content:
  4. Setup a subdomain monitoring.ask-sheldon.com as a new website (sites tab in ISPConfig) with Let’s Encrypt (https://letsencrypt.org/) as SSL-maintainer and such stuff.
  5. Enabled http-proxy module for Apache:
     
  6. Add the proxy definition to the Apache directives in ISPConfig:
     

    The Apache directives can be found in the site administration of the respective website in the options tab as shown below.

    Setup monit behind Apache proxy - Apache directives

 

That’s it! That’s how I setup monit behind Apache proxy. Now I was able to call monit via the following URL in webbrowser:

https://monitoring.ask-sheldon.com/monit/

Finally I put this URL together with the given credentials to the server configuration of ISPConfig (System Tab -> Server Config):

Setup monit behind Apache proxy - Server Config

Afterwards the monit monitoring can be seen in ISPConfig backend (Monitor Tab -> Show Monit)
Setup monit behind Apache proxy - Monit

Leave a Reply

Your email address will not be published. Required fields are marked *