First use of monit does not monitor daemons

Issue #1028 resolved
Bernhard Zaun created an issue

Hi,

the problem appears if you set the statefile to /dev/null or if you start
monit for the first time. When starting monit for the first time, the
statefile does not exist yet. So the behavior is the same in that case.

So in that case if you start the daemons via "monit start all" the
daemons are started, but if you observe the daemons via "monit summary"
the status is "Not monitored".

Until commit 4953651474008e67479cc00700bae86035de64a8 (5.26.some) the
status was "OK".

See https://github.com/marvinthepa/monit_bug_repro for a setup how to
reproduce the bug.

I tested on “OpenBSD 7.0 GENERIC.MP#1 amd64” and on“Linux version
5.4.0-97-generic (Ubuntu 9.3.0-17ubuntu1~20.04)“

I also tested the latest version
(9fd40f0948273d661b4fd1fce6abff1eaebad848) with a revert of
4953651474008e67479cc00700bae86035de64a8 . That worked for me :)

With kind regards

Bernhard Zaun

Comments (8)

  1. Tildeslash repo owner

    The boot timestamp is recorded in the statefile. If you remove the statefile between each monit start, then it cannot compare the boot time of the previous run => works as if the machine just booted. As your service has "onreboot nostart" option, it won't be monitored automatically. The statefile role is important

  2. Martin Sander

    Hey Tildeslash,

    As your service has "onreboot nostart" option, it won't be monitored automatically.

    This is correct, and we do not expect that to happen.

    However, we start the services manually afterwards using:

    monit -g the_group start or monit start all

    After that, I would expect the services to be monitored. However, they are not.

  3. Tildeslash repo owner

    Fixed: Issue #1028: When the Monit statefile was removed, the "monit start <service>" action for services with "onreboot nostart" option started the service, but didn't enable the monitoring. The same problem occurred if a new "onreboot nostart" service was added, even if the statefile existed.

    → <<cset 1a414506d931>>

  4. Log in to comment