mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-29 18:50:39 +00:00
Fix: Remove Prom. metrics on delete monitor
This commit is contained in:
parent
a48176bd48
commit
f6ef390c76
3 changed files with 16 additions and 0 deletions
|
@ -468,6 +468,11 @@ class Monitor extends BeanModel {
|
|||
this.isStop = true;
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
let prometheus = new Prometheus(this);
|
||||
prometheus.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper Method:
|
||||
* returns URL object for further usage
|
||||
|
|
|
@ -84,6 +84,16 @@ class Prometheus {
|
|||
}
|
||||
}
|
||||
|
||||
remove() {
|
||||
try {
|
||||
monitor_cert_days_remaining.remove(this.monitorLabelValues);
|
||||
monitor_cert_is_valid.remove(this.monitorLabelValues);
|
||||
monitor_response_time.remove(this.monitorLabelValues);
|
||||
monitor_status.remove(this.monitorLabelValues);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -733,6 +733,7 @@ exports.entryPage = "dashboard";
|
|||
|
||||
if (monitorID in monitorList) {
|
||||
monitorList[monitorID].stop();
|
||||
monitorList[monitorID].onDelete();
|
||||
delete monitorList[monitorID];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue