Monitoring the use of software monit
Installation: sudo apt-get install monit
Configuration file: sudo vim /etc/monit/monitrc
The main configuration options are as follows:
SMTP server for outgoing mail, here using AWS Simple Mail Service
set mailserver email-smtp.us-west-xx.amazonaws.com port 587
username "AKIAJxxxxxxxxxxxxxxxx" password "Axxxxxxxxxxxxxxxxxxxxxxxxxxx"
using tlsv1
with timeout 30 seconds
collectors
#email address which will receive monit alerts
set alert sim@abc.com
If you don't need monit, email yourself every time you reload
set alert sim@abc.com not {instance}
message format
set mail-format {
from: sim@abc.com
subject: XXX alert -- $EVENT $SERVICE
message: $EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: XXX Server
Description: $DESCRIPTION
Monitor System
}
enable http
Enable httpd: set httpd port 2812
#Then: sudo monit reload
#Then: localhost:2812
This profile already contains a number of monitoring options that can be configured on demand
Start monit: sudo monit
Other common commands
sudo monit status
sudo service monit status
sudo monit reload = sudo service monit restart
Check log:
sudo tail -f /var/log/monit.log
grep sshd /var/log/monit.log
Check syntax:
sudo monit -t
If you need to customize your own monitoring project, you can save the configuration file here: /etc/monit/conf.d/Monitoring disk space remaining alarm
sudo vim /etc/monit/conf.d/storagespace
check filesystem Media with path /dev/sdb1df
if space usage > 90% then alert
Monitor mounted external folders
check filesystem Compal-NAS-Croissant with path /test/ABC
if changed fsflags then alert
- Monitoring network connections
check host WWW with address 192.20.1.40
if failed ping then alert