succeeded keyword leads to unexpected behavior and wrong status/summary

Juergen Unger <[email protected]> Sat, 26 Jul 2025 23:36:00 +0200
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <[email protected]>
--Apple-Mail=_10140E28-9920-405D-BDCF-90C34F4880EF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hi,

I am using monit to monitor some machines.
Before I only got notifications via email, this worked without problems.
The configuration I used to check a host was simple:

check host somehost.exmaple.org with address 10.11.12.13
	if failed ping then alert
set alert [email protected]
set mailserver localhost port 25
set mail-format {
        from: [email protected]
        subject: Monit-Alert
}

Now I added a script to send me notifications to my iPhone too and added =
one line

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


even this is working ok, when I am ignoring that I now getting two mails =
for each event.
Now the issue:  the script was only executed on host failure, but not on =
host recovery,
so I added one more line:

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

superficially this works fine, I am getting up and down notifications =
via email and
on my iPhone via script which sends push messages.
Later I recognized that some details are now wrong:

monit status and monit summary are now reporting the host status as =
=E2=80=9AICMP failed=E2=80=98
and the monit.log show errors where there are successful ping checks:

[2025-07-26T21:25:22+0000] error    : 'host.example.com' ping test =
succeeded [response time 15.623 ms]

[email protected]:~# monit summary
Monit 5.33.0 uptime: 3h 49m
=
=E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90
=E2=94=82 Service Name                    =E2=94=82 Status               =
      =E2=94=82 Type          =E2=94=82
=
=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4
=E2=94=82 my.server.com                   =E2=94=82 OK                   =
      =E2=94=82 System        =E2=94=82
=
=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4
=E2=94=82 host.exmaple.com                =E2=94=82 ICMP failed          =
      =E2=94=82 Remote Host   =E2=94=82
=
=E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=B4=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98

I assume this is a bug, or is there any configuration which can change =
the behavior to the correct one?

thnx in advance,
J=C3=BCrgen









--Apple-Mail=_10140E28-9920-405D-BDCF-90C34F4880EF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;">Hi,<div><br></div><div>I am using monit to monitor =
some machines.</div><div>Before I only got notifications via email, this =
worked without problems.</div><div>The configuration I used to check a =
host was simple:</div><div><br></div><div><font face=3D"Courier =
New">check host somehost.exmaple.org with address =
10.11.12.13</font></div><div><font face=3D"Courier New"><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>if failed =
ping then alert</font></div><div><div><font face=3D"Courier New">set =
alert [email protected]</font></div><div><font face=3D"Courier New">set =
mailserver localhost port 25</font></div><div><font face=3D"Courier =
New">set mail-format {</font></div><div><font face=3D"Courier =
New">&nbsp; &nbsp; &nbsp; &nbsp; from: =
[email protected]</font></div><div><font face=3D"Courier New">&nbsp; =
&nbsp; &nbsp; &nbsp; subject: Monit-Alert</font></div><div><font =
face=3D"Courier New">}</font></div></div><div><br></div><div>Now I added =
a script to send me notifications to my iPhone too and added one =
line</div><div><br></div><div><div><font face=3D"Courier New">check host =
somehost.exmaple.org with address 10.11.12.13</font></div><div><font =
face=3D"Courier New"><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>if failed ping then alert</font></div></div><div><font =
face=3D"Courier New"><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>if failed ping then exec =
/root/bin/notify.sh</font></div><div><br></div><div><br></div><div>even =
this is working ok, when I am ignoring that I now getting two mails for =
each event.</div><div>Now the issue: &nbsp;the script was only executed =
on host failure, but not on host recovery,</div><div>so I added one more =
line:</div><div><br></div><div><div><div><font face=3D"Courier =
New">check host somehost.exmaple.org with address =
10.11.12.13</font></div><div><font face=3D"Courier New"><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if failed =
ping then alert</font></div></div><div><font face=3D"Courier New"><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if failed =
ping then exec /root/bin/notify.sh</font></div></div><div><font =
face=3D"Courier New"><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>if&nbsp;succeeded ping then exec =
/root/bin/notify.sh</font></div><div><br></div><div>superficially this =
works fine, I am getting up and down notifications via email =
and</div><div>on my iPhone via script which sends push =
messages.</div><div>Later I recognized that some details are now =
wrong:</div><div><br></div><div>monit status and monit summary are now =
reporting the host status as =E2=80=9AICMP failed=E2=80=98</div><div>and =
the monit.log show errors where there are successful ping =
checks:</div><div><br></div><div><font face=3D"Courier =
New">[2025-07-26T21:25:22+0000] error &nbsp; &nbsp;: 'host.example.com' =
ping test succeeded [response time 15.623 =
ms]</font></div><div><br></div><div><div><font face=3D"Courier =
New">[email protected]:~# monit summary</font></div><div><font =
face=3D"Courier New">Monit 5.33.0 uptime: 3h 49m</font></div><div><font =
face=3D"Courier =
New">=E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90</font></div><div><font=
 face=3D"Courier New">=E2=94=82 Service Name &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=E2=94=82 Status &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =E2=94=82 Type =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=E2=94=82</font></div><div><font =
face=3D"Courier =
New">=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4</font></div><div><font=
 face=3D"Courier New">=E2=94=82 my.server.com &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =E2=94=82 OK &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
=E2=94=82 System &nbsp; &nbsp; &nbsp; &nbsp;=E2=94=82</font></div><div><fo=
nt face=3D"Courier =
New">=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4</font></div><div><font=
 face=3D"Courier New">=E2=94=82 host.exmaple.com &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=E2=94=82 ICMP failed &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=E2=94=82 Remote Host &nbsp; =
=E2=94=82</font></div><div><font face=3D"Courier =
New">=E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=B4=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98</font></div></div><div=
><br></div><div>I assume this is a bug, or is there any configuration =
which can change the behavior to the correct =
one?</div><div><br></div><div>thnx in =
advance,</div><div>J=C3=BCrgen</div><div><br></div><div><br></div><div><br=
></div><div><br></div><div><br></div><div><br></div><div><br></div><div><b=
r></div></body></html>=

--Apple-Mail=_10140E28-9920-405D-BDCF-90C34F4880EF--