Monit is a free, simple and effective monitoring tool that can help you keep an eye on your home server and services while also perform actions like restart or stop services if some events happens.

It can also monitor your filesystems for overload and free space.

Check: Gentoo Wiki Monit page for specific Gentoo suggestions, which i will mostly repeat also in this page.


First of all, installing MonIt is pretty easy:

emerge -v monit

To start monit, while it is recommended to start monit through the /etc/inittab so that init itself launches the monit application, i suggest to put it in local.d as the last daemon started. This is to prevent Monit to try restart daemons before the full startup sequence is completed.

So create /etc/local.d/99-monit.start:


#Start monit last to prevent it from trying to spawn services while local.d is still starting
/etc/init.d/monit start

And make the script executable.


Monit is configured from it's main config file /etc/monitrc. I assume you want your users in the users group to be allowed Monit access, and also you want to disable the default admin/monit password. So edit the /etc/monitrc file and do the following changes:

... omissis ...
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    # comment this line to disable default user!
    allow @users                  # allow members of the //users// group to access Monit
... omissis ...
## It is possible to include additional configuration parts from other files or
## directories.
include /etc/monit.d/*    # uncomment this line to enable custom configs!
... omissis ...    

You will place all your custom monitors under /etc/monit.d/ folder. For example, to monitor your filesystems create the file /etc/monit.d/filesystems:

check filesystem Data with path /data
     if space usage > 90% then alert

check filesystem Deposito with path /deposito
     if space usage > 90% then alert

check filesystem Root with path /
     if space usage > 90% then alert

And to monitor some services:

check process sonarr with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service sonarr start'"
    stop program  = "/bin/bash -c 'rc-service sonarr stop'"

check process radarr with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service radarr start'"
    stop program  = "/bin/bash -c 'rc-service radarr stop'"

check process readarr with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service readarr start'"
    stop program  = "/bin/bash -c 'rc-service readarr stop'"

check process readarr-audiobooks with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service readarr-audiobooks start'"
    stop program  = "/bin/bash -c 'rc-service readarr-audiobooks stop'"

check process lidarr with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service lidarr start'"
    stop program  = "/bin/bash -c 'rc-service lidarr stop'"

check process prowlarr with pidfile /var/run/
    start program = "/bin/bash -c 'rc-service prowlarr start'"
    stop program  = "/bin/bash -c 'rc-service prowlarr stop'"

And to monitor some network links:

check network ISP1 with interface enp0s20f0u4u4c2
    if link down then alert
    if changed link then alert

check network ISP2 with interface enp59s0u2u4c2
    if link down then alert
    if changed link then alert

check network internal with interface enp0s31f6
    if link down then alert
    if changed link then alert

Feel free to add/edit as needed.

To have monit read the changes, issue the command:

monit reload

Reverse Proxy

Create the following NGINX configuration file:

location /monit/ {
        rewrite ^/monit/(.*) /$1 break;
        proxy_ignore_client_abort on;
        proxy_redirect /monit; 
        proxy_cookie_path / /monit/;

place it accordingly to The Reverse Proxy concept and restart NGINX.

Start & Test

Now start it manually, no need to reboot the server for this:

/etc/init.d/monit start

Open your browser and head to to login with your user credentials (or a user in the users group!)