Here's what I have configured:
if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
but when I do monit validate it throws following error:
/etc/monit/conf.d/frontendLogger.conf:19: syntax error 'else'
The else in the above configuration is the 19th line.
check process frontendLogger matching frontendLogger
start program = "/bin/systemctl start frontendLogger"
stop program = "/bin/systemctl stop frontendLogger"
restart program = "/bin/systemctl restart frontendLogger"
group nodejs
if failed host 127.0.0.1 port 10500 protocol http
request /ping
content = "PONG"
with timeout 2 seconds
for 2 times in 4 cycles
then restart
if failed host
vr.com port 443 type TCPSSL protocol http
request /logger/ping
content = "PONG"
with timeout 2 seconds
for 2 times within 4 cycles
then restart
if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
if does not exist for 3 times in 10 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
if changed pid for 3 times in 10 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
if memory > 70 MB for 3 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
if cpu > 1% for 3 cycles then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
----- END -----
From: monit-general <address@hidden> on behalf of Rui Lapa <address@hidden>
Sent: Thursday, June 16, 2016 4:49 PM
To: This is the general mailing list for monit
Subject: Re: Syntax for else if
ELSE IF SUCCEEDED THEN
not
ELSE IF <test> THEN