Your SlideShare is downloading. ×
Monit - NHRuby May 2009
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Monit - NHRuby May 2009

955
views

Published on

Monit is a reliable and simple to configure tool for monitoring and managing processing and resources on UNIX based systems. Presented to the NH Ruby User Group on 21 May 2009.

Monit is a reliable and simple to configure tool for monitoring and managing processing and resources on UNIX based systems. Presented to the NH Ruby User Group on 21 May 2009.

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
955
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Monit Keeping UNIX Deployments
  • 2. Monitor & Manage System Resources Processes Files Directories Devices Network Services
  • 3. Take Action! alert Send an alert restart Stop then start a process start Start a process stop Stop a process exec Execute arbitrary program unmonit Disable monitoring or timeout Disable monitoring
  • 4. Prerequisites UN*X Start/Stop Scripts for Processes Mail Server for Alerts
  • 5. Configure ~/.monitrc /etc/monitrc /usr/local/etc/monitrc ~/monitrc $ monit -c /etc/monit/monitrc $ monit -t
  • 6. Configure ## /etc/monit/monitrc set daemon 120 set logfile /var/log/monit.log set alert alert@brianturnbull.com set mail-format { from: monit@brianturnbull.com subject: $SERVICE service - $EVENT message: $ACTION $SERVICE on $HOST: $DESCRIPTION } set mailserver localhost port 25 set httpd port 8877 allow monit:passwd include /etc/monit/monit.d/*
  • 7. Monitor ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if failed host localhost port 80 protocol http then restart if 2 restarts within 3 cycles then timeout ## /etc/monit/monit.d/sshd check process sshd with pidfile /var/run/sshd.pid start program = quot;/etc/init.d/ssh startquot; stop program = quot;/etc/init.d/ssh stopquot; if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout
  • 8. Monitor Files ## /etc/monit/monit.d/apache_log check file access.log with path /var/log/apache2/access.log if size > 100Mb then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot; check file error.log with path /var/log/apache2/error.log if size > 100Mb then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot;
  • 9. Monitor Directories ## /etc/monit/monit.d/sbin check directory sbin with path /sbin if changed timestamp then alert check directory sbin-usr with path /usr/sbin if changed timestamp then alert
  • 10. Monitor Devices ## /etc/monit/monit.d/disks check device sda1 with path /dev/sda1 if space usage > 90% then alert if inode usage > 90% then alert
  • 11. Monitor Resources ## /etc/monit/monit.d/system check system brianturnbull.com if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 75% then alert if cpu usage (user) > 70% then alert if cpu usage (system) > 30% then alert if cpu usage (wait) > 20% then alert
  • 12. Monitor Services ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if failed host localhost port 80 protocol http then restart if 2 restarts within 3 cycles then timeout ## /etc/monit/monit.d/mail check host mail.brianturnbull.com with address mail.brianturnbull.com if failed port 25 expect “^220.*rn” send “HELO brianturnbull.com expect “^250.*rn” send “QUIT.*rn” expect “^221.*rn” then alert
  • 13. Dependancies ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid group www start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if 2 restarts within 3 cycles then timeout if failed host localhost port 80 protocol http then restart depends on apache_bin depends on apache_rc check file apache_bin with path /usr/sbin/apache2 group www if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor check file apache_rc with path /etc/init.d/apache2 group www if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor
  • 14. More Info & Examples http://mmonit.com/monit Thank You http://brianturnbull.com

×