|
From: | Mike D |
Subject: | Re: [EXTERNAL] Restart apps based on total system CPU usage |
Date: | Thu, 18 Feb 2021 12:12:05 -0700 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |