Website: mmonit.com
Monit won't start
/etc/default/monit
... set daemon 120 # check every 120 seconds ... check process sshd with pidfile /var/run/sshd.pid # check the process which is running with the given pid-file start program "/etc/init.d/ssh start" # if monit must restart the daemon which script must be used to start or stop stop program "/etc/init.d/ssh stop" if failed port 22 protocol ssh then restart # if port 22 is unaccessible then restart the daemon if 5 restarts within 5 cycles then timeout # if restart fail 5 times then give up
############################################################# ## # Email fuer Alerts set daemon 120 set mailserver localhost set mail-format { from: server@example.com subject: [$ACTION] $HOST $SERVICE $EVENT - monit } set alert admin@example.com ## ############################################################# ## fill level ## ## fill level boot-partition check device bootfs with path /dev/sda1 if space usage > 80% then alert ## ############################################################# ## Security Checks ## ## /etc check directory etc with path /etc if changed timestamp then alert ############################################################# ## essential Services ## ## ssh check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh stop" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout ## ## cron check process cron with pidfile /var/run/crond.pid alert admin@example.com only on { nonexist } group system start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" if 5 restarts within 5 cycles then timeout ##
set httpd port 8080 and use address 192.168.1.100 allow admin:password
set httpd port 2812 and SSL ENABLE PEMFILE /var/certs/monit.pem allow admin:test
check host webserver.example.org with address webserver.example.org if failed port 80 protocol http for 5 cycles then alert
check host switch.example.org with address switch.example.org if failed icmp type echo count 5 with timeout 15 seconds then alert