Re: succeeded keyword leads to unexpected behavior and wrong status/summary

Juergen Unger <[email protected]> Tue, 29 Jul 2025 12:26:28 +0200
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <[email protected]>
Hello Lutz,

thnx, this solved the problem with the wrong status..
'monit status' and 'monit summary=E2=80=98 now giving the correct =
status.

It even seems that I do not need the first =E2=80=9Aif failed ping then =
alert=E2=80=98,
because =E2=80=9Aif failed ping then exec =E2=80=A6=E2=80=98 also sends =
a mail in parallel.

J=C3=BCrgen

> Am 28.07.2025 um 21:30 schrieb Lutz Mader <[email protected]>:
>=20
> Hello Juergen,
> based on your sample snipped,
> you should have a look to NETWORK PING TEST,
> https://mmonit.com/monit/documentation/monit.html#NETWORK-PING-TEST
>=20
>> check host somehost.exmaple.org with address 10.11.12.13
>>  if failed ping then alert
>>  if failed ping then exec /root/bin/notify.sh
>>  if succeeded ping then exec /root/bin/notify.sh
>=20
> =46rom my point of view, the proper test should look like this.
>=20
> check host somehost.exmaple.org with address 10.11.12.13
>  if failed ping then alert
>  if failed ping then exec /root/bin/notify.sh
>    else if succeeded then exec /root/bin/notify.sh
>=20
> "if failed ..." will send an alert if the ping failed and "else if
> succeeded ..." will send a recovery alert.
>=20
> The test icmp was changed to ping a long time ago (with 5.9.0), I get
> "ICMP failed" if ping failed (with 5.35.0).
>=20
> A suggestion only,
> Lutz
>=20