#Monit
Lightweight process and system monitoring.
#Overview
Monit is a small, proactive monitoring utility.
| Feature | Description |
|---|---|
| Process monitoring | Keep services running |
| File monitoring | Watch files/directories |
| Network | Check ports/protocols |
| Auto-remediation | Restart failed services |
#Installation
bash
sudo apt install monit
sudo systemctl enable monit#Configuration
cfg
1# /etc/monit/conf.d/nginx
2check process nginx with pidfile /var/run/nginx.pid
3 start program = "/etc/init.d/nginx start"
4 stop program = "/etc/init.d/nginx stop"
5 if failed host 127.0.0.1 port 80 protocol http
6 with timeout 10 seconds
7 then restart
8 if 5 restarts within 5 cycles then alert#Commands
bash
1# Check syntax
2sudo monit -t
3
4# Reload config
5sudo monit reload
6
7# Status
8sudo monit status
9
10# Web UI (enable in monitrc)
11# http://localhost:2812[!TIP] Pro Tip: Perfect for simple service supervision and auto-restart!