Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider no new MQTT messages as a failiure and mark the monitor as down #2037

Open
1 task done
PhilipWhiteside opened this issue Sep 4, 2022 · 5 comments
Open
1 task done
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added

Comments

@PhilipWhiteside
Copy link

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

Other

🔖 Feature description

Currently a message from long ago can match the monitor message and be marked as up. If an MQTT client has failed to send a message into the MQTT server the monitor will still pass as up. Uptime Kuma should consider no messages as a failure and mark the monitor as down.

✔️ Solution

Perform the MQTT monitor and check if the matched message was sent since the last check, or if no new messages have been send. No new messages should fail as down.

  1. Perform the MQTT monitor check
  2. Check the timestamp of the matched message
  3. Was the timestamp within the current heartbeat interval (E.g. now - 60s).
  4. If yes, is up. If no, is down.

❓ Alternatives

No response

📝 Additional Context

No response

@PhilipWhiteside PhilipWhiteside added the feature-request Request for new features to be added label Sep 4, 2022
@cmh716
Copy link

cmh716 commented May 17, 2023

I'm surprised there aren't more requests for this. I am struggling to find a use for the MQTT monitor, given this behavior. Has anyone found a workaround? I have shelly modules that send an MQTT message every minute, but Uptime Kuma always sets the test as successful because of old messages.

@wsw70
Copy link

wsw70 commented May 28, 2023

I am struggling to find a use for the MQTT monitor

I agree. The reason, I think, is that usually monitoring is active: you request something and if the reply is there then it is ok. Otherwise it is a failure.

In the case of MQTT it is either the other way round (no messages = problem), or the content of the message (the payload) matters (temperature is 35°C, it is > 30 so raise an alert).

As far as I can tell, the current MQTT monitor does neither of them, so it is hardly usable.

I use MQTT a lot for home automation (Home Assistant) and as a general-purpose bus for my home code. Having the ability to check for a heartbeat (and ideally, a content analysis as I mentioned in #2405 (comment)) would be awesome.

@stephenrobi
Copy link

I agree that for this feature to be minimally useful, that there should be a way to consider the age of the most recent message to determine the current status of the monitor.

@AndLindemann
Copy link

Agreed, especially when the status messages have a retain flag set, unless the device specifically set itself to unavailable, the monitor would always come back with a success result, so you would never catch anything that's not a planned maintenance.

@stroodle96
Copy link

Has anyone found a work around for this?
Being able to check how old the mqtt message is fail if older tham a defined time limit would be really nice.

@CommanderStorm CommanderStorm added the area:monitor Everything related to monitors label Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

7 participants