[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [EXTERNAL] Restart apps based on total system CPU usage
From: |
Lutz Mader |
Subject: |
Re: [EXTERNAL] Restart apps based on total system CPU usage |
Date: |
Thu, 18 Feb 2021 19:56:06 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hello Mike,
you can do this.
> Thanks for the script Mark. I'm not sure it suits my needs. I essentially
> just want to know if Monit can do something like:
>
> check system $HOST
> if cpu usage (system) > 20% for 2 cycles then $restart_a_given_app
check system $HOST
every 5 cycles
# if loadavg (1min) > 4 then alert
# if loadavg (5min) > 2 then alert
if cpu usage > 95% for 10 cycles then alert
if memory usage > 95% for 20 cycles then alert
if swap usage > 50% for 20 cycles then alert
if swap usage > 30% for 10 cycles then exec
"/usr/local/etc/monit/scripts/aixpgsp.sh 100"
repeat every 20 cycles
if swap usage > 50% for 10 cycles then exec
"/usr/local/etc/monit/scripts/aixpgsp.sh 50"
repeat every 10 cycles
#
The problem is, to find the right application. But this works well, as
long as you know the application.
if cpu usage > 95% for 10 cycles then exec "/usr/local/bin/monit
restart given_app"
This is the reason Mark use a script to find this application and I use
a script to find the application that use the storage.
But you can check a specific application also, see
https://mmonit.com/monit/documentation/monit.html#CONFIGURATION-EXAMPLES
With regards,
Lutz