Monit
Jump to navigation
Jump to search
When a full-blown Naemon installation is to exhaustive, we could employ Monit to do the job. Example configuration:
$ cat /etc/monitrc set daemon 30 # check services at 30 seconds intervals with start delay 60 # optional: delay the first check by one minute set log syslog set mailserver mail.example.net port 25 set alert admin@example.net include /etc/monit.d/*
Let's test for a specific network connection and act on it if it's not available:
$ cat /etc/monit.d/autossh check process autossh with pidfile /tmp/autossh_foobar.pid start program = "/usr/local/sbin/autossh-wrapper.sh start foobar" stop program = "/usr/local/sbin/autossh-wrapper.sh stop foobar" if changed pid then alert if failed host localhost port 25 protocol smtp with timeout 30 seconds then alert if 3 restarts within 5 cycles then timeout
More examples can be found in the Monit wiki.