Query data of the current status via javascript
⚠️ Please verify that this bug has NOT been raised before.
- [X] I checked and didn't find similar issue
🛡️ Security Policy
- [X] I agree to have read this project Security Policy
📝 Describe your problem
Is there a way to query the status of a service via javascript and then execute something? I'm not very familiar with javascript yet, but can someone give me an example of how this could work?
🐻 Uptime-Kuma Version
1.16.0
💻 Operating System and Arch
Ubuntu 20.04
🌐 Browser
Chrome
🐋 Docker Version
No response
🟩 NodeJS Version
No response
Whilst there is currently no public API you could use the prometheus /metrics file and parse that using JavaScript. In terms of how it would work you would first need to make a get request using the fetch API (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch). Then you could go about parsing the data and extracting the parts you need. This would probably require a bit of regex and some string manipulation. A quick google search yeilded this node library that you might wish to check out https://github.com/yunyu/parse-prometheus-text-format
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.
This issue was closed because it has been stalled for 7 days with no activity.