System monitoring runs every 45 seconds. The first check is delayed
by 120 seconds to avoid overloading the system immediately after boot.
set daemon 45with start delay 120
Monit logs to syslog. `idfile` and `statefile` store Monit’s
persistent state and identity across restarts.
set log syslogset idfile /var/monit/idset statefile /var/monit/state
Limits control buffer sizes and timeouts for
program outputs, network I/O, and service start/stop/restart
operations. This prevents Monit from hanging or processing excessive data.
Monit will send alerts via local email. Events are queued under `/var/monit/events` to prevent message loss during temporary network problems.
set mailserver localhostset eventqueuebasedir /var/monit/eventsslots 200set mail-format { from: root@monit }set alert root@localhost not on { instance, action }
Simply comment out or delete all `set alert` entries:
# set alert root@localhost not on { instance, action }
After this, Monit will not send any emails, but it will still monitor services.
Monit HTTP interface is on port 2812. Access is restricted to localhost,
a local subnet (`192.168.X.0/24`), and an admin user with a password.
set httpd port 2812 andallow localhostallow 192.168.X.0/255.255.255.0allow admin:foobar
Monit will start all monitored services
automatically on reboot.
set onreboot start
This monitors overall system health:
1- and 5-minute load per CPU core
CPU usage
Memory and swap usage
If thresholds are exceeded, it triggers `pushover.sh` for alerts.
check system $HOSTif loadavg (1min) per core > 2 for 5 cycles then exec /usr/local/bin/pushover.shif loadavg (5min) per core > 1.5 for 10 cycles then exec /usr/local/bin/pushover.shif cpu usage > 95% for 10 cycles then exec /usr/local/bin/pushover.shif memory usage > 75% then exec /usr/local/bin/pushover.shif swap usage > 25% then exec /usr/local/bin/pushover.shgroup system
`/home` filesystem is monitored for:
Disk space and inode usage
Read/write throughput (MB/s and IOPS)
Service response time
Alerts are sent via `pushover.sh` if any threshold is exceeded.
check filesystem home_fs with path /dev/sd0kstart program="/sbin/mount /home"
stop program = "/sbin/umount /home"
if space usage > 90% then exec /usr/local/bin/pushover.sh
if inode usage > 95% then exec /usr/local/bin/pushover.sh
if read rate > 8 MB/s for 20 cycles then exec /usr/local/bin/pushover.sh
if read rate > 800 operations/s for 15 cycles then exec /usr/local/bin/pushover.sh
if write rate > 8 MB/s for 20 cycles then exec /usr/local/bin/pushover.sh
if write rate > 800 operations/s for 15 cycles then exec /usr/local/bin/pushover.sh
if service time > 10 milliseconds for 3 times within 15 cycles then exec /usr/local/bin/pushover.sh
group system
Root filesystem `/` has similar checks but shorter cycles since it’s critical to system stability.
check filesystem root_fs with path /dev/sd0astart program="/sbin/mount /"
stop program = "/sbin/umount /"
if space usage > 90% then exec /usr/local/bin/pushover.sh
if inode usage > 95% then exec /usr/local/bin/pushover.sh
if read rate > 8 MB/s for 5 cycles then exec /usr/local/bin/pushover.sh
if read rate > 800 operations/s for 5 cycles then exec /usr/local/bin/pushover.sh
if write rate > 8 MB/s for 5 cycles then exec /usr/local/bin/pushover.sh
if write rate > 800 operations/s for 5 cycles then exec /usr/local/bin/pushover.sh
if service time > 10 milliseconds for 3 times within 5 cycles then exec /usr/local/bin/pushover.sh
group system
Monit ensures secure permissions for `/root`. If permissions are wrong, monitoring for this directory is disabled to avoid false alarms.
check directory bin with path /rootif failed permission 700 then unmonitorif failed uid 0 then unmonitorif failed gid 0 then unmonitorgroup system
A network host is ping-checked. Frequent failures trigger alerts. Dependencies on
interfaces and services ensure checks only run when the network is up.
check host homeassistant with address 192.168.X.19if failed ping then alertif 5 restarts within 10 cycles then exec /usr/local/bin/pushover.shgroup networkdepends on iface_in,dhcpd,unbound
Monit watches network interface `pppoeX`:
Restarts interface if link goes down
Alerts on saturation or high upload
Limits repeated restarts to avoid loops
check network iface_out with interface pppoeXstart program="/bin/sh /etc/netstart pppoeX"
if link down then restart else exec /usr/local/bin/pushover.sh
if changed link then exec /usr/local/bin/pushover.sh
if saturation > 90% then exec /usr/local/bin/pushover.sh
if total uploaded > 5 GB in last hour then exec /usr/local/bin/pushover.sh
if 5 restarts within 10 cycles then exec /usr/local/bin/pushover.sh
group network
DNS resolver `unbound` is monitored by PID and port. Failures trigger a restart, repeated failures trigger alerts.
check process unbound with pidfile /var/unbound/unbound.pidstart program="/usr/sbin/rcctl start unbound"
stop program = "/usr/sbin/rcctl stop unbound"
if failed port 53 for 3 cycles then restart
if 3 restarts within 10 cycles then exec /usr/local/bin/pushover.sh
group network
depends on dnscrypt_proxy,iface_out,iface_in
DHCP server is monitored. Missing process triggers a restart. Alerts are sent if failures happen repeatedly.
check process dhcpd with matching /usr/sbin/dhcpdstart program="/usr/sbin/rcctl start dhcpd"
stop program = "/usr/sbin/rcctl stop dhcpd"
if does not exist then restart
if 2 restarts within 10 cycles then exec /usr/local/bin/pushover.sh
group network
depends on iface_in
NTP daemon ensures time synchronization. Missing process triggers restart; repeated issues generate alerts.
check process ntpd with matching /usr/sbin/ntpdstart program="/usr/sbin/rcctl start ntpd"
stop program = "/usr/sbin/rcctl stop ntpd"
if does not exist then restart
if 5 restarts within 5 cycles then exec /usr/local/bin/pushover.sh
group network
depends on iface_out
vnStat daemon monitors network traffic statistics. Monit restarts it if it stops and alerts on repeated failures.
check process vnstatd with matching /usr/local/sbin/vnstatdstart program="/usr/sbin/rcctl start vnstatd"
stop program = "/usr/sbin/rcctl stop vnstatd"
if does not exist then restart
if 5 restarts within 15 cycles then exec /usr/local/bin/pushover.sh
group network
depends on iface_out
Adding Pushover Alerts
Testing and Maintenance
Conclusion
Using Monit together with Pushover is an excellent way to keep a close eye on an OpenBSD router.
Monit is tiny, fast, and reliable — perfect for embedded hardware.
Pushover provides instant alerts with almost no configuration or overhead.
For a home router or small business network, this combination gives you
semi professional-grade monitoring with minimal effort.