Monday, December 3, 2012

Monitoring a process using monit

[root@FSWWW cg]# vim /usr/local/etc/monitrc




check process StaticScan_files.rb with pidfile /opt/FS_QPID/StaticScan/StaticScan_files.rb.pid
    start program = "/opt/FS_QPID/StaticScan/StaticScan_files_control.rb start" with timeout 60 seconds
    stop program  = "/opt/FS_QPID/StaticScan/StaticScan_files_control.rb stop"
    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
    if loadavg(5min) greater than 10 for 8 cycles then stop

check process query_files.rb with pidfile /opt/FS_QPID/PDF/querystatus/query_files.rb.pid
    start program = "/opt/FS_QPID/PDF/querystatus/query_files_control.rb start" with timeout 60 seconds
    stop program  = "/opt/FS_QPID/PDF/querystatus/query_files_control.rb stop"
    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
    if loadavg(5min) greater than 10 for 8 cycles then stop

check process upload_files.rb with pidfile /opt/FS_QPID/PDF/uploadfile/upload_files.rb.pid
    start program = "/opt/FS_QPID/PDF/uploadfile/upload_files_control.rb start" with timeout 60 seconds
    stop program  = "/opt/FS_QPID/PDF/uploadfile/upload_files_control.rb stop"
    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
    if loadavg(5min) greater than 10 for 8 cycles then stop

No comments:

Post a Comment