Slide 1

Slide 1 text

Monit utility for monitoring services on Unix

Slide 2

Slide 2 text

Problem - Don't know when your system is going to failed If it failed - You need to get it up and running ASAP

Slide 3

Slide 3 text

Monit: What & Why - Automatically monitor your system - It is lightweight - Easy to install - Very stable - No require another separate management server - Has a great configuration syntax

Slide 4

Slide 4 text

What to monitor - Disk space - Memory usage - CPU consumption - Process - Host - Port - File / Directory

Slide 5

Slide 5 text

Installation $> sudo apt-get install monit

Slide 6

Slide 6 text

/etc/monit/monitrc set daemon 30 set logfile /var/log/monit.log set mailserver localhost set alert [email protected] set httpd port 2812 include /etc/monit/conf.d/*

Slide 7

Slide 7 text

Check system check system localhost.localdomain if loadavg (1min) > 8 then alert if loadavg (5min) > 5 then alert if memory usage > 75% then alert if swap usage > 25% then alert if cpu usage (user) > 70% then alert if cpu usage (system) > 30% then alert if cpu usage (wait) > 20% then alert

Slide 8

Slide 8 text

Check process check process apache with pidfile /var/run/apache2.pid group www start "/etc/init.d/apache2 start" stop "/etc/init.d/apache2 stop" if cpu > 60% for 2 cycles then alert if cpu > 80% for 25 cycles then restart if totalmem > 2100.0 MB for 5 cycles then restart if loadavg (5min) > 10 for 8 cycles then stop if failed port 80 then restart if 5 restarts within 5 cycles then timeout

Slide 9

Slide 9 text

Check port check process mysql with pidfile /var/run/mysqld/mysqld.pid group db start "/etc/init.d/mysql start" stop "/etc/init.d/mysql stop" if failed port 3306 protocol mysql then restart if 5 restarts within 5 cycles then timeout

Slide 10

Slide 10 text

Check host, ping & port check host my_example with address example.com group network if failed icmp type echo with timeout 15 seconds then alert if failed port 5060 type udp protocol sip then alert

Slide 11

Slide 11 text

Matching process name check process verboice with matching "ruby lib/services/broker.rb" group app start "/sbin/start verboice" stop "/sbin/stop verboice" if cpu > 60% for 2 cycles then alert if cpu > 80% for 15 cycles then restart if totalmem > 1800.0 MB for 5 cycles then restart if loadavg (5min) > 8 for 8 cycles then restart if 5 restarts within 5 cycles then timeout

Slide 12

Slide 12 text

Check file & directory check file access_log with path /var/log/access_log if size > 100 Mb then alert check directory sbin with path /sbin if changed timestamp then alert

Slide 13

Slide 13 text

Monit command-line $> monit summary $> monit status $> monit reload $> monit start [all | name] $> monit stop [all | name]

Slide 14

Slide 14 text

More settings and examples http://mmonit.com/monit/documentation/monit.html