Friday, May 20, 2011

Monit - Superb service in Asterisk

Since I installed it, It has made our lives easy and relax-able. Whenever asterisk crashes, monit restarts it.

Install monit by "yum install monit" or rpm

http://packages.sw.be/monit/monit-5.2.3-1.el4.rf.x86_64.rpm
http://packages.sw.be/monit/monit-5.2.3-1.el4.rf.i386.rpm

Then open /etc/monit.conf and at the end add these lines

# Asterisk Monitoring rule
set daemon 30 # Check every 30s
set mailserver localhost
set mail-format { from: monit@yourdomain.com }
set logfile syslog facility log_daemon
set alert noc@yourdomain.com (or what ever email address you want)
check process asterisk with pidfile /var/run/asterisk.pid
start program = "/etc/init.d/asterisk start"
stop program = "/etc/init.d/asterisk stop"
if 5 restarts within 5 cycles then timeout

service monit start
chkconfig monit on

Also you can check load average and cpu usag

if loadavg (5min) > 15 then alert
if memory usage > 85% then alert

if cpu usage (user) > 80% then alert
if cpu usage (system) > 70% then alert
if cpu usage (wait) > 70% then alert

Also start sendmail if it is not running


That is it, so what do you guyz say?

Do check this out!

No comments: