the monit check is like this
## eXtremeSHOK.com
check program contego with path "/etc/monit/scripts/contego"
group CONTEGO
start program = "/etc/init.d/contego start" with timeout 900 seconds
stop program = "/etc/init.d/contego start"
if status != 0 then stop #restart
if 5 restarts within 5 cycles then alert
## eXtremeSHOK.com
============
Should work ;-P
## eXtremeSHOK.com
errorcount=`tail -n 10 /mnt/vouchers/contego.log | grep "Error" | wc -l`
if [ $errorcount -gt 0 ] ; then
echo "OK working"
exit 0
else
echo "$errorcount" 1>&2;
exit 10
fi
## eXtremeSHOK.com
On 3/20/2014 3:39 PM, Martin Vaner wrote:
Hello all,
i have a one question.
I am using monit to monitor all of our servers all around the world,
but i have a little problem in this moment.
I need to monitor one log file using external bash script (logtest.sh):
/#!/bin/bash
errorcount=`tail -n 10 /mnt/vouchers/contego.log | grep "Error" | wc -l`
if [ $errorcount -gt 0 ]; then
exit 0;
else
exit $?;
fi/
So, when i run this script from the console, it is working fine. I
tried to do test in the monitrc file, as described here:
http://goo.gl/LviXBV (monit official how to):
/check program contego_errors with path /usr/local/bin/logtest.sh //
// if status != 0 then alert
/I also tried to put quotes in the path, but monit still getting this
error:
/Failed to execute '/usr/local/bin/logtest.sh' -- Exec format error
/Do you have some tips & tricks, how can i run this script to test
what i need? I also tried something like:
"/bin/bash '/usr/local/bin/logtest.sh'" and any other combinations of
"" and '' ... And i am still getting the same error.
Thank you,
Regards,
Martin
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general