stop action not called on unmonitored service

Issue #1023 new
Aaron Knister created an issue

It looks like commit c51a0050dc03e0d1bac252c9f8631f0ae38b59ba changed the behavior of the stop action on an unmonitored service:

 static boolean_t _doStop(Service_T s, boolean_t unmonitor) {
         ASSERT(s);
         boolean_t rv = true;
-        if (! s->depend_visited) {
-                s->depend_visited = true;
-                if (s->stop) {
+        if (s->stop) {
+                if (s->monitor != Monitor_Not) {
                         int exitStatus;
                         char msg[STRLEN];
                         long timeout = s->stop->timeout * USEC_PER_SEC;

I think prior to this commit you could run a “stop” action on an unmonitored service and the stop action would execute. Now that’s not the case.

The man page seems to me to suggest the previous behavior is still expected:

STOP stops the service by calling the service's registered stop method and send an alert. If Monit stops a service it will not be checked by Monit anymore nor restarted again later. To reactivate monitoring of the service again you must explicitly enable monitoring from the web interface or from the console.

I’m happy to submit a fix, but could someone confirm what the expected behavior is?

Comments (2)

  1. Lutz Mader

    Hello Aaron,
    a question of understandig, a comment.

    From my point of view, a “Not Monitored” resource should not affected by the monitor.

    Unfortunately, a resources with status “Not Monitored” will ignored by the monitor if you stop your system via the monitor. But this is a problem of the status handling of the monitor, there is a status “Ok” (“Up”, “Online”) but no status “Down” (“Offline”), therefore the monitor does not differ a “Down” from a “Not Monitored” resource.

    With regards,
    Lutz

  2. Log in to comment