Difference between revisions of "Monit"
From FusionPBX
(→Configure) |
(→Configure) |
||
Line 30: | Line 30: | ||
'''FreeSWITCH''' | '''FreeSWITCH''' | ||
− | check process freeswitch with pidfile /usr/local/freeswitch/run/freeswitch.pid | + | check process freeswitch with pidfile /usr/local/freeswitch/run/freeswitch.pid |
− | start program = "/usr/local/freeswitch/bin/./freeswitch -nc -u www-data" with timeout 60 seconds | + | start program = "/usr/local/freeswitch/bin/./freeswitch -nc -u www-data" with timeout 60 seconds |
− | stop program = "/usr/local/freeswitch/bin/./freeswitch -stop" | + | stop program = "/usr/local/freeswitch/bin/./freeswitch -stop" |
− | if cpu > 60% for 2 cycles then alert | + | if 5 restarts within 5 cycles then timeout |
− | if cpu > 80% for 5 cycles then restart | + | |
− | if totalmem > 200.0 MB for 5 cycles then restart | + | Optional - Additional monit config |
− | if children > 250 then restart | + | if cpu > 60% for 2 cycles then alert |
+ | if cpu > 80% for 5 cycles then restart | ||
+ | if totalmem > 200.0 MB for 5 cycles then restart | ||
+ | if children > 250 then restart |
Revision as of 20:13, 31 October 2012
Used to monitor processes on UNIX systems.
Install
CentOS
yum install monit chkconfig --levels 235 monit on
Ubuntu
apt-get install monit
Edit Monit /etc/default/monit and set the "startup" variable to 1 in order to allow monit to start
Configure
Fail2Ban
cd /etc/monit.d echo "" > fail2ban
nano fail2ban Add the following to the file and save it.
check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid group services start program = "/etc/init.d/fail2ban start" stop program = "/etc/init.d/fail2ban stop" if 5 restarts within 5 cycles then timeout
FreeSWITCH
check process freeswitch with pidfile /usr/local/freeswitch/run/freeswitch.pid start program = "/usr/local/freeswitch/bin/./freeswitch -nc -u www-data" with timeout 60 seconds stop program = "/usr/local/freeswitch/bin/./freeswitch -stop" if 5 restarts within 5 cycles then timeout
Optional - Additional monit config
if cpu > 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if totalmem > 200.0 MB for 5 cycles then restart if children > 250 then restart