linux:moni_ubu_9_10
Table of Contents
Monit with Ubuntu 9.10
- Using an old configuration without rewriteing it can be causes some problems.
- Ubuntu 9.10 (monit version: “5.0.x” and 8.04 version: “4.8.x”).
Website: mmonit.com
Problem
Monit won't start
- Solution is very simple but wasn't needed since the new version.
- I compared my configuration with this here and of course I found differences.
- In Ubuntu 8.04 monit checks about 3-5 minutes.
- In Ubuntu 9.10 the same configuration won't start.
Solution
- Enter the interval for checking and postfix starts, but it doesn't send any mail.
- if you have an local postfix configured set the mail server to localhost.
Configuration
- Monit must be activated in
/etc/default/monit
- What do the configuration lines:
... 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
Example
- monit.rc
############################################################# ## # 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 ##
More functions
Monit with webinterface
- You can activate a small webserver in monit so you can monitor your services via http
set httpd port 8080 and use address 192.168.1.100 allow admin:password
- Perhaps you can also use ssl but I don't tested it (See here)
set httpd port 2812 and SSL ENABLE PEMFILE /var/certs/monit.pem allow admin:test
Check other Server
- Check an Webinterface
check host webserver.example.org with address webserver.example.org if failed port 80 protocol http for 5 cycles then alert
- Check if Server can be reached via icmp (ping)
check host switch.example.org with address switch.example.org if failed icmp type echo count 5 with timeout 15 seconds then alert
Links
linux/moni_ubu_9_10.txt · Last modified: 23.03.2013 17:37 by eanderalx