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

MQTT Monitor Type - Timeout #1669

Closed
2 tasks done
tam481 opened this issue May 21, 2022 · 15 comments · May be fixed by #5398
Closed
2 tasks done

MQTT Monitor Type - Timeout #1669

tam481 opened this issue May 21, 2022 · 15 comments · May be fixed by #5398

Comments

@tam481
Copy link

tam481 commented May 21, 2022

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

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

I am unable to monitor the status of an MQTT server. I specified the URL, Port, Username and Password but it keeps returning
'MQTT': Failing: Timeout | Interval: 60 seconds | Type: mqtt

I don't know how to diagnose this problem. I searched existing issues and found nothing.

🐻 Uptime-Kuma Version

1.15.1

💻 Operating System and Arch

Debian Bullseye on Raspberry Pi 4 ARM64

🌐 Browser

Google Chrome 100

🐋 Docker Version

20.10.16

🟩 NodeJS Version

No response

@tam481 tam481 added the help label May 21, 2022
@tulamidan
Copy link

I experience a similar issue. I get frequent timeout warnings - but have no reason to believe my broker has issues. The systems behaves normal and all mqtt clients get the data just fine.

@louislam
Copy link
Owner

I think it is logged in to your mqtt broker successfully, but Uptime Kuma don't receive topic response within 40 seconds.

@buliwyf42
Copy link

buliwyf42 commented May 26, 2022

I had the same issue, and I just found out that the topic part is case-sensitive. Perhaps this is the issue for yourself as well. Unfortunately, the “error” message from Kuma was not helpful at all. “Timeout” keeps me questioning if the connection works at all.

@tam481
Copy link
Author

tam481 commented May 29, 2022

@louislam I don't think that's the case here. I tried subscribing and kept sending a message to the topic to keep it updated and still got the timeout error.

@buliwyf42 the topic case matches exactly what's on the broker. I don't think that's the case here.

@tulamidan
Copy link

  • I increased the test interval to 120s and I don't get any more errors. Before I got either a message with the topic value - or with the timeout error. Now I get the availability but no ping value and therefore the graph is empty.

@github-actions
Copy link

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 13, 2022
@tulamidan
Copy link

Maybe the issue is not really an issue: If your topic is not updated within the timeframe of the kuma update interval - the test will fail.
Yet the mqtt broker might be happy and alive - so I am not sure what to suggest.

@github-actions github-actions bot removed the Stale label Sep 14, 2022
@github-actions
Copy link

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.

@github-actions github-actions bot added the Stale label Dec 13, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 2 days with no activity.

@AleksCee
Copy link

Ok this issue is Close but I have the same Timeout if I configure 2 MQTT Task with the same MQTT Server. If I deactivating one of them, no timeout issue, but when both are active the timeout is occur. The MQTT Server is the Node-Modul from https://flows.nodered.org/node/node-red-contrib-aedes - is this a new perspective for this issue or should I open a new one?
THX, Alex

@louislam
Copy link
Owner

@AleksCee Feel free to open a bug issue if it is reproducible.

The current implementation is here:

exports.mqttAsync = function (hostname, topic, okMessage, options = {}) {

@EricDuminil
Copy link

EricDuminil commented May 3, 2024

FWIW, I was using a wildcard (+ or #) as a topic, to check if any sensor was sending data.

MQTT Monitor was connecting, and receiving messages. It still failed with TIMEOUT because of this check messageTopic === topic: https://github.com/louislam/uptime-kuma/blob/master/server/monitor-types/mqtt.js#L104

sensors/+ isn't exactly sensors/xyz, so this condition was never true. I'm not sure why this check is here. If a message is received while the client is subscribed to a topic, its topic must be correct.

@bkkoli
Copy link

bkkoli commented Aug 23, 2024

@EricDuminil

If a message is received while the client is subscribed to a topic, its topic must be correct.

It is very helpful for me. Thank you

@4ley
Copy link

4ley commented Nov 20, 2024

FWIW, I was using a wildcard (+ or #) as a topic, to check if any sensor was sending data.

MQTT Monitor was connecting, and receiving messages. It still failed with TIMEOUT because of this check messageTopic === topic: https://github.com/louislam/uptime-kuma/blob/master/server/monitor-types/mqtt.js#L109

sensors/+ isn't exactly sensors/xyz, so this condition was never true. I'm not sure why this check is here. If a message is received while the client is subscribed to a topic, its topic must be correct.

I hit the same issue. Wildcards are not possible.

@EricDuminil
Copy link

EricDuminil commented Nov 29, 2024

I simply removed the if (messageTopic === topic) check, and MQTT monitor worked perfectly fine with wildcards, both in 1.23.15 and beta2.

sensors/#, sensors/+/info received messages and the monitor was green. If I replaced the topic with an incorrect one, e.g. typo/# or #/info, no message was received, the monitor timed out and was red.

AFAICT, it shouldn't change the behavior for topics without wildcard.

EricDuminil added a commit to EricDuminil/uptime-kuma that referenced this issue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants