uptime-kuma icon indicating copy to clipboard operation
uptime-kuma copied to clipboard

Add additional labels to a monitor

Open xathon opened this issue 1 year ago • 1 comments

📑 I have found these related issues/pull requests

The issue is similar to #4344 and the issues linked in there, but this request is more about passing additional options to a notification.

🏷️ Feature Request Type

API / automation options, Change to existing notification-provider

🔖 Feature description

I would like to be able to add additional "labels" to a monitor, which could be passed to a notification. Those keys and values should be configurable by the user and usable in the notification wizard by referencing the monitor JSON.

✔️ Solution

The monitor json object should be extended to hold the labels:

[...]
  "monitor": {
    "id": 2,
    "name": "test",👈🏻👈🏻👈🏻👈🏻👈🏻
    "url": "https://test",
    "hostname": null,
    "port": null,
    "maxretries": 0,
    "weight": 2000,
    "active": 1,
    "type": "http",
    "interval": 60,
    "keyword": null,
    "notificationIDList": {
      "3": true
    },
    "labels": {
        "my_label": "my_value",
        "my_other_label": "my_other_value"
    }
},
[...]

These labels should be configured on the monitor add/edit page.

❓ Alternatives

No response

📝 Additional Context

My use case is that I want to pass container names to a script which automatically restarts them. It would be possible to use the friendly name for that, but sometimes the name of the docker container is different to the name I picked for it in UK.

An alternative use case could e.g. be that an e-mail is sent to different persons based on what's specified in the monitor.

xathon avatar Jan 29 '24 23:01 xathon