[Top][All Lists]

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

Re: Monit $ Bash wrong exit value?

From: Martin Vaner
Subject: Re: Monit $ Bash wrong exit value?
Date: Thu, 05 Jun 2014 13:57:36 +0200
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Ok, thanks :)

On 5. 6. 2014 13:56, Martin Pala wrote:

You can add echo to print some error message before exit, but the exit value is 
what is checked by Monit

On 05 Jun 2014, at 13:50, Martin Vaner <address@hidden> wrote:

So if i understand correctly, i should have something like "exit 1" instead of  
"echo $errorcount".


On 5. 6. 2014 13:48, Martin Pala wrote:

Monit check for exit value - not output (echo vs. exit).


On 05 Jun 2014, at 13:45, Martin Vaner <address@hidden> wrote:

Hello all,
i have a one little problem. I have bash script, which look like this (somebody 
have already seen it here).

errorcount=`tail -n 10 contego.log | grep "Error" | wc -l`
if [ $errorcount -gt 0 ]; then
echo $errorcount
echo 0

When i run the scrip from the console, and the file contego.log contains 
"Error" word,  the output is:
address@hidden:/mnt/vouchers# ./

But Monit still working with exit value 0, so it doesn't send alerts when the 
file contains 10 Errors.

Program                                   'contego_errors'
status                                        Status ok
monitoring status                Monitored
last started                             Thu, 05 Jun 2014 13:28:28
last exit value                       0
data collected                       Thu, 05 Jun 2014 13:28:28

The monit config is look like this:

check program contego_errors with path /mnt/vouchers/
     if status != 0 then alert

Do you have some tips, how to get this to work?

To unsubscribe:
To unsubscribe:

To unsubscribe:

To unsubscribe:

reply via email to

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