Inconsistent Behavior with 'if 2 restarts within 2 cycles' Condition

Issue #1075 new
和田竜郎 created an issue

I have observed an inconsistent behavior with the 'if 2 restarts within 2 cycles' condition in Monit. Here is the sequence of events:

  1. if does not exist condition is met (Service does not exist). Monit executes restart, which succeeds (Service exists).
  2. else if succeeded condition is met (Service exists). Monit passes the check.
  3. if does not exist condition is met again (Service does not exist). Monit executes restart, which succeeds (Service exists).
  4. if does not exist condition is met again (Service does not exist). Monit executes restart, which succeeds (Service exists).
  5. else if succeeded condition is met (Service exists). Monit passes the check.

In this sequence, the service restarts three times, but the 'if 2 restarts within 2 cycles' condition is not met. I believe this is inconsistent and could lead to unexpected behavior. I would appreciate if you could look into this issue.

Here is a sequence diagram for reference:

I have observed a consistent behavior with the 'if 2 restarts within 2 cycles' condition in Monit. Here is the sequence of events:

  1. if does not exist condition is met (Service does not exist). Monit executes restart, which succeeds (Service exists).
  2. else if succeeded condition is met (Service exists). Monit passes the check.
  3. Monitoring cycle passes with all checks OK.
  4. if does not exist condition is met again (Service does not exist). Monit executes restart, which succeeds (Service exists).
  5. if does not exist condition is met again (Service does not exist). Monit executes restart, which succeeds (Service exists).
  6. else if succeeded condition is met (Service exists). Monit passes the check.

In this sequence, the service restarts three times, and the 'if 2 restarts within 2 cycles' condition is met. This behavior is consistent and expected.

Here is a sequence diagram for reference:

Why does this inconsistency occur?

Comments (6)

  1. 和田竜郎 reporter

    Hello,

    I posted this issue two weeks ago and haven't received any feedback yet. I understand everyone is busy, but I'm really stuck on this problem and could use some guidance.

    Is there anyone who could take a look at this issue and provide some insights or suggestions? Any help would be greatly appreciated.

    Thanks in advance for your time and assistance.

  2. Lutz Mader

    Hello, a question to

    1. Monitoring cycle passes with all checks OK.

    what do you mean.

    From my point of view the condition of "if 2 restarts within 2 cycles" will met with the third restart. Try to use three or more cycles, two cycles does not fit well.

    Sorry,
    this requires some additional tests,
    Lutz

  3. 和田竜郎 reporter

    Thank you for your response.

    what do you mean.

    I made a mistake in the explanation. The arrows pointing from User to Monit were incorrect.

    Please disregard the statement 'Monitoring cycle passes with all checks OK.'

    It was simply meant to indicate that all checks specified in the monit.conf file were passed without any issues.

    Try to use three or more cycles, two cycles does not fit well.

    Yes, I will follow your suggestion and try using three or more cycles. I understand that two cycles may not be sufficient.

  4. Lutz Mader

    Hello,
    thanks for your answer.

    Yes, I will follow your suggestion and try using three or more cycles. I understand that two cycles may not be sufficient.

    The problem is, the way how monit count and when. In general the status will evaluated with the next check cycle, when the timeout has expired.

    Lutz

  5. Log in to comment