louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
60.7k stars 5.42k forks source link

Lower heartbeat interval when monitor is `DOWN`? #4025

Closed Vincent-HD closed 6 months ago

Vincent-HD commented 1 year ago

⚠️ Please verify that this bug has NOT been raised before.

🛡️ Security Policy

📝 Describe your problem

I would like the possibility to lower the heartbeat interval when a monitor is marked as DOWN. For example, here I have an Interval of 30 min betweens checks and 60 sec x 3 on pending. But as soon as it is marked as DOWN, it checks every 30 min again, can we change that behaviour?

It's useful if I don't want to “spam” our websites with checks, but I want to be able to be notified as soon as I want when a monitor is back up

So it would be, for example:

Thank you 👍

📝 Error Message(s) or Log

No response

🐻 Uptime-Kuma Version

1.23.1

💻 Operating System and Arch

Ubuntu 20.04.5

🌐 Browser

Vivaldi 6.4.3160.42

🐋 Docker Version

23.0.0

🟩 NodeJS Version

No response

chakflying commented 1 year ago

Interesting, I think it would be more reasonable if the retry interval applies to down status as well.

louislam commented 1 year ago

Actually true, don't know why didn't think about it.

doitlikejustin commented 11 months ago

+1 for this!

CommanderStorm commented 11 months ago

@doitlikejustin Please refrain from posting +1 / requests for updates things on issues, as this makes issue-management harder. Issues are for discussing what needs to be done how by whom. We use 👍🏻 on issues to prioritise work, as always: Pull Requests welcome.

neelbhanushali commented 9 months ago

@louislam

  1. Kindly validate if I understand the transition between Monitor Statuses (PENDING, UP, DOWN) correctly
  2. If my understanding about the transition is correct, also validate the requirement by @Vincent-HD (OP)
    • OP wants to change the behavior where the next action taken after DOWN status is Hit every Heartbeat Interval
    • Instead, there should be another input that controls transitioning from DOWN to UP; similar to how Heartbeat Retry Interval controls transitioning from PENDING to UP after a failure.

Flowchart

flowchart TD
    Start(Start => `!hasPreviousBeat`)
    P2(((Pending)))
    P(((Pending)))
    U(((Up)))
    D(((Down)))
    HI[Hit every `Heartbeat Interval`]
    HRI[Hit every `Heartbeat Retry Interval`]
    Reset_R[Reset `Retries` counter]
    isUp{Check successfull?}
    isMaxRetry{`Retries`-limit reached?}

    Start --> P2
    P2 --> HI
    HI --> isUp

    isUp --> |No| isMaxRetry
    isUp --> |Yes| Reset_R
    Reset_R --> U

    isMaxRetry --> |No| P
    P --> HRI
    isMaxRetry --> |Yes| D

    HRI --> isUp
    D --> HI
    U --> HI
Flow Chart Details

1. Monitor Status are circle (`PENDING`, `UP`, `DOWN`) 1. Rectangles are actions performed by Uptime Kuma 1. Rhombuses are checks

CommanderStorm commented 9 months ago

I have edited the diagram[^1] to hopefully clear the question a bit up (inlining, clarifying).

In terms of correctness of the diagram:

In terms of proposal:

[^1]: The ability to have mermaid diagrams is very handy. ❤️

neelbhanushali commented 9 months ago

@CommanderStorm

For the case @Vincent-HD mentioned, another field would be handly

It's useful if I don't want to “spam” our websites with checks, but I want to be able to be notified as soon as I want when a monitor is back up

So it would be, for example:

  • Check every 30 min if UP
  • Check every 30 sec if PENDING and max 3 times
  • Check every 5 min if DOWN

However, I totally agree

  • Reusing the Heartbeat Retry Interval for DOWN beats (as suggested by @chakflying) seems intuitive enough. I don't think another setting needs to be added.

Modifying @Vincent-HD case as below can be a win-win

  • Check every 30 min if UP
  • Check every 30 sec if PENDING and max 3 times
  • Check every 30 sec if DOWN

I'm willing to send a PR for this

I've gone through the Contribution Guidelines

I will be creating my branch from master and will be sending the PR back to master considering this as a new feature Let me know if I need to switch to 1.23.X