Added MQTT Monitor type
#875
Open
tarun7singh wants to merge 7 commits from tarun7singh/master
into master
pull from: tarun7singh/master
merge into: topaLE:master
topaLE:1.6.X
topaLE:1.7.X
topaLE:1.9.X
topaLE:Mikhail5555/feature/remote-header-auth
topaLE:Nuckerr/master
topaLE:Saibamen/fix_871
topaLE:WillianRod/feat/add-favicon-badges
topaLE:andreasbrett/logging
topaLE:andreasbrett/securepush
topaLE:bertyhell/bugfix/heartbeat-bar-animation
topaLE:bertyhell/feature/monitor-checks
topaLE:bertyhell/feature/translations-extraction-script
topaLE:cert-notification
topaLE:chakflying/settings-redesign
topaLE:debian-docker
topaLE:deefdragon/Template-Engine
topaLE:deefdragon/notif-tests
topaLE:e2e-test
topaLE:fdcastel/push-api-tags
topaLE:free-disk-space
topaLE:ivanbratovic/http-basicauth
topaLE:ivanbratovic/improve-translatables
topaLE:k8s-unofficial
topaLE:lucasra1/overall_status
topaLE:master
topaLE:mhkarimi1383/master
topaLE:mrphuongbn/master
topaLE:no-need-build
topaLE:philippdormann/feature/release-management
topaLE:proffalken/feature/680_add_labels_to_prometheus_metrics
topaLE:proffalken/feature/auto_build_and_release
topaLE:rebasesoftware/feature/request-with-http-proxy
topaLE:restructure-status-page
topaLE:sqlite-upgrade-prebuilt
topaLE:thomasleveil/feature/565-duplicate-monitor
topaLE:thomasleveil/ux/add-group-at-the-top
Reviewers
Request review
No reviewers
Labels
Something isn't working dependencies
Pull requests that update a dependency file discussion doc
Improvements or additions to documentation duplicate
This issue or pull request already exists feature-request
New feature or request good first issue
Good for newcomers hacktoberfest hacktoberfest-accepted help help wanted
Extra attention is needed High
High Priority impossible invalid
This doesn't seem right investigating k8s Low
Low Priority Medium
Medium Priority News prerelease bug question
Further information is requested resolved Unknown wontfix
This will not be worked on
Apply labels
Clear labels
bug
Something isn't working dependencies
Pull requests that update a dependency file discussion doc
Improvements or additions to documentation duplicate
This issue or pull request already exists feature-request
New feature or request good first issue
Good for newcomers hacktoberfest hacktoberfest-accepted help help wanted
Extra attention is needed High
High Priority impossible invalid
This doesn't seem right investigating k8s Low
Low Priority Medium
Medium Priority News prerelease bug question
Further information is requested resolved Unknown wontfix
This will not be worked on
No Label
bug
dependencies
discussion
doc
duplicate
feature-request
good first issue
hacktoberfest
hacktoberfest-accepted
help
help wanted
High
impossible
invalid
investigating
k8s
Low
Medium
News
prerelease bug
question
resolved
Unknown
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This pull request currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch 'tarun7singh/master'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Description
Added MQTT monitor type for monitoring mqtt message and alert if a message is different from preset success message.
Type of change
Please delete options that are not relevant.
Checklist
Screenshots (if any)
Maybe change
url
key toserverUrl
?Is there a way to set the ping value as well?
Is there a way to set the ping value as well?
@srgvg MQTT Monitor type is here. Thank you all.
There's a merge commit from upstream master in this PR. I couldn't rebase it properly on upstream master without merge conflicts. @tarun7singh I recommend you work on a differntly named feature branch, not on your local master branch. Or at least, don't pull upstream changes with a merge, but rebase your work on top of it.
My mqtt servers are authenticated. Does this PR allow authentication?
I tried building the container from @tarun7singh master branch, but that fails, not sure why?
@srgvg
The path need to be the project root.
Build cmd should be like this:
Thx @louislam
now fails diferently:
Ops, target is missing
hmm, once the container started with
docker run --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma -e NODE_ENV=development uptime-kuma-mqtt-nightly
, I don't get anything in browser, only@srgvg No this only allows for unauthenticated mqtt servers for now, I'm planning to add this.
@louislam Currently, the main issue I'm facing and need help with is that I'm setting up a listener for MQTT messages on each heartbeat which is not ideal, is there any way to set it up once on monitor start and then update the heartbeat/data based on messages received?
That will block me from testing this I'm afraid.
I forgot that I changed the workflow recently.
You have to build the frontend first by
npm run build
then build the docker image.If you don't have local development environment, I think you can go to the container shell and build inside the container:
@tarun7singh I agree that having to connect every time is a bit inefficient. I guess changing it to have a persistent connection will make it work like the push monitor type, but it would be a pretty big change.
Prefix
mqtt_
for better meaning.Prefix
mqtt_
for better meaning.Although it is not the best method, I still prefer your current implementation, because it is straightforward and and it is not likely to be buggy.
While with a persistent connection, as @chakflying said, it is a big change. You may have to implement a connection pool to handle all expected and unexpected network things. Usually lead to be unstable. Also Uptime Kuma itself no such similar monitor type for reference, it is a completely new monitor type. I guess it would be hard.
Done
done
@louislam
Yes, it could be added as a long-term tasks to support these types of monitors.
@srgvg
You can test it by using https://test.mosquitto.org
I tested by pushing a periodic green message to this and sending a red message to trigger a down status.
Also I'll take care to not use master branch.