monit-general
[Top][All Lists]
Advanced

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

Monit $ Bash wrong exit value?


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

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

#!/bin/bash
errorcount=`tail -n 10 contego.log | grep "Error" | wc -l`
if [ $errorcount -gt 0 ]; then
echo $errorcount
else
echo 0
fi

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


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/logtest.sh
    if status != 0 then alert


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

Martin

reply via email to

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