monit-general
[Top][All Lists]
Advanced

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

Re: how exec a command


From: Martin Pala
Subject: Re: how exec a command
Date: Wed, 12 Nov 2014 17:31:38 +0100

Hi,

monit executes the program directly, if you want to use pipe, you need to wrap 
the whole command like this:

        if cpu > 1% for 2 cycles then exec "/bin/bash -c 'top -bn1 | mail -s 
top address@hidden'"


Regards,
Martin


> On 12 Nov 2014, at 17:01, address@hidden wrote:
> 
> Howdy, I try to add an option to send (exactly the output of top by
> email), so I've added that line:
> 
> if cpu > 75% for 2 cycles then exec "/bin/bash -c top -bn1 | mail -s top
> address@hidden"
> 
> as below (but does not run)
> 
> any idea?
> 
> thanks!
> 
> Pol
> 
> # APACHE
> 
>  check process apache with pidfile /var/run/apache2.pid
>    start program = "/etc/init.d/apache2 start" with timeout 60 seconds
>    stop program  = "/etc/init.d/apache2 stop"
>    if cpu > 60% for 2 cycles then alert
>    if cpu > 80% for 5 cycles then restart      # 10minutes
>    if cpu > 1% for 2 cycles then exec "/bin/bash -c top -bn1 | mail -s
> top address@hidden"
>    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
>    if failed host 192.168.1.212 port 80 protocol http
>       and request "/monit/token"
>       then restart
> 
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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