- changed status to invalid
First use of monit does not monitor daemons
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)
-
repo owner -
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
ormonit start all
After that, I would expect the services to be monitored. However, they are not.
-
repo owner ok, sorry for misunderstanding, will try to reproduce the problem
-
repo owner - changed status to open
-
Thanks for the quick response and monit in general
-
reporter The problem appears since 4953651474008e67479cc00700bae86035de64a8 AND only when starting monit for the first time (because of the missing statefile I guess).
-
repo owner - changed status to resolved
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>>
-
reporter wow, that was a fast fix! ty
- Log in to comment
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