Skip to content

Instantly share code, notes, and snippets.

@eksiscloud
Last active October 28, 2019 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eksiscloud/93d8368ec7ba7a2def2a4c554206d809 to your computer and use it in GitHub Desktop.
Save eksiscloud/93d8368ec7ba7a2def2a4c554206d809 to your computer and use it in GitHub Desktop.
Starting point for new install of Monit server monitoring
set daemon 60 #check services every 60 seconds
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
#Event queue
set eventqueue
basedir /var/lib/monit/events # set the base directory where events will be stored
slots 100 # optionally limit the queue size
#Mail settings
set mail-format {
from: monit@$HOST
subject: monit alert -- $EVENT $SERVICE
message: $EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
Description: $DESCRIPTION
Your faithful employee,
Monit }
# set mailserver email-smtp.eu-west-1.amazonaws.com port 587 # depends of region, this is EU (Ireland)
# set mailserver smtp.gmail.com port 587
# set mailserver smtp.mailgun.org
# username "postmaster@example.com" password "very-difficult-one"
# using TLSV1 with timeout 30 seconds # AWS SES needs that, Mailgun doesn't, Gmail IDK
set alert user@example.com not on { instance, action } #email address which will receive monit alerts
#http settings
set httpd port 2812 address 0.0.0.0 # allow port 2812 connections on all network adapters
# ssl enable # use OpenSSL if you like
# pemfile /var/certs/monit.pem
# allow 0.0.0.0/0.0.0.0 # allow all IPs, can use local subnet too
# allow www.example.tld # allow dynamicdns address to connect
#set httpd port 2812 and
# use address localhost
# allow localhost
allow joedoe:"passwd" # require user joedoe with password passwd
check system <ip-address>
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if swap usage > 25% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
check filesystem rootfs with path / #Alert if low on disk space.
if space usage > 90% then alert
#allow modular structure
include /etc/monit/conf.d/*
include /etc/monit/conf-enabled/*
@eksiscloud
Copy link
Author

When installing Monit, backup original /etc/monit/monitrc and use this instead. Read the original one anyway, there is a lot of info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment