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

Deleted monitors still show in /metrics #598

Closed
hippsabq opened this issue Oct 7, 2021 · 13 comments · Fixed by #1136
Closed

Deleted monitors still show in /metrics #598

hippsabq opened this issue Oct 7, 2021 · 13 comments · Fixed by #1136
Labels
bug Something isn't working

Comments

@hippsabq
Copy link

hippsabq commented Oct 7, 2021

Is it a duplicate question?
I looked and did not find anything

Describe the bug
If you remove a monitor from the dashboard, the monitor and its last status still show up in the metrics page. This also occurs if you modify the monitor_url. Changing the monitor url also creates a redundant line in the metrics output.

I am scraping these into Prometheus and using the Grafana Dashboard, but all deleted or modified monitors will show up and remain in my dashboard.

To Reproduce
Steps to reproduce the behavior:
the example I use in the screenshot is Plex.

  1. I first setup a Plex monitor to look at the "ipaddress:port" of my plex server
  2. The monitor came back down since the plex web ui is under "ipaddress:port/web/"
  3. I modified the Plex monitor to include the "/web" ending
  4. Navigated to /metrics of my uptime-kuma server
  5. Noticed that a duplicate "Plex" monitor was created and the first incorrect one was still there showing down
  6. Deleted the "Plex" monitor altogether
  7. Navigated to /metrics of my uptime-kuma server
  8. Noticed that both "Plex" monitors were still output to the /metrics

Expected behavior

  1. Modifications to a monitor do not create a duplicate /metrics output
  2. Deleted monitors no longer show up in /metrics output

Info
Uptime Kuma Version: 1.7.3
Using Docker?: Yes
Docker Version: 20.10.9
Node.js Version (Without Docker only):
OS: Win 10
Browser: Brave

Screenshots
image
image

Error Log

@hippsabq hippsabq added the bug Something isn't working label Oct 7, 2021
@deefdragon
Copy link
Contributor

This appears to also happen if you change the name of the monitor.

@RisedSky
Copy link
Contributor

This appears to also happen if you change the name of the monitor.

Seems like the URL is changed, maybe it duplicates because of it ?

@louislam
Copy link
Owner

https://github.com/louislam/uptime-kuma/blob/master/server/prometheus.js

It seems that there is no "remove logic" in the current implement. May need to remove the monitor from all gauges if the monitor is stopped.

@x4FF3
Copy link

x4FF3 commented Dec 6, 2021

as i am not familiar with JS, is this going to be fixed anytime soon?

@gruessung
Copy link

+1

@Coliinnn
Copy link

Coliinnn commented Jan 6, 2022

Also experiencing this issue. A fix would be great, unfortunately I am also not experienced enough with JS. Alternatively, does anyone know of a way to filter out a specific monitor from within Prometheus or Grafana?

@chakflying
Copy link
Collaborator

Took a shot at it in #1136, please check.

@Proxymiity
Copy link

A quick and easy hack is to restart the container. Restarting seems to have cleared every duplicated monitor.
It's as easy as docker-compose restart or docker restart uptime-kuma :)

@kyuuk
Copy link

kyuuk commented Feb 19, 2022

Little workaround:
To clean monitors that have been deleted/renamed i discovered that you need to clear all statistics from database in the settings, like this
image

@nmcc1212
Copy link

Still an issue, and clearing all statistics didn't work

@louislam
Copy link
Owner

louislam commented Mar 25, 2022

#1136

May need someone to test this pr, as I dont using Prometheus.

@nmcc1212
Copy link

i am testing it with now, but you don't need prometheus to see if it works, just change/delete an endpoint and check uptime-kuma:3001/metrics and see if the value still exists/ has changed

@nmcc1212
Copy link

nmcc1212 commented Mar 25, 2022

just tested it with prometheus, it works well and is pretty much instant (less than 1 second delay between edit/delete and updating prometheus endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.