monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EXTERNAL] Restart apps based on total system CPU usage


From: Mike D
Subject: Re: [EXTERNAL] Restart apps based on total system CPU usage
Date: Thu, 18 Feb 2021 12:12:05 -0700

Hey Lutz,

I know specifically what app I would like to restart so your solution looks like it may help me.

Thanks,
Mike

On Thu, Feb 18, 2021 at 11:56 AM Lutz Mader <lutz.mader@freenet.de> wrote:
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]