From 39fa2a33610ee04d980b6d31bbd7779eb6356c45 Mon Sep 17 00:00:00 2001 From: polarstack <42521003+polarstack@users.noreply.github.com> Date: Sat, 12 Aug 2023 10:23:24 +0200 Subject: [PATCH] feat(ntfy): enable prometheus metrics (#11389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ntfy support prometheus metrics: https://docs.ntfy.sh/config/#monitoring This PR adds the ckeckbox in questions.yaml and the metrics: section in values.yaml. The ntfy metrics variable is activated if user selects prometheus metrics. It is disabled by default ⚒️ Fixes # **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: polarstack <42521003+polarstack@users.noreply.github.com> --- charts/stable/ntfy/Chart.yaml | 2 +- charts/stable/ntfy/questions.yaml | 2 ++ charts/stable/ntfy/values.yaml | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/charts/stable/ntfy/Chart.yaml b/charts/stable/ntfy/Chart.yaml index 6dfc200418e..c64474e41b9 100644 --- a/charts/stable/ntfy/Chart.yaml +++ b/charts/stable/ntfy/Chart.yaml @@ -18,7 +18,7 @@ name: ntfy sources: - https://github.com/truecharts/charts/tree/master/charts/stable/ntfy - https://github.com/binwiederhier/ntfy/ -version: 6.0.0 +version: 6.0.1 annotations: truecharts.org/catagories: | - media diff --git a/charts/stable/ntfy/questions.yaml b/charts/stable/ntfy/questions.yaml index 59711cff91a..0604a871722 100644 --- a/charts/stable/ntfy/questions.yaml +++ b/charts/stable/ntfy/questions.yaml @@ -321,6 +321,8 @@ questions: default: 568 # Include{resources} +# Include{metrics} +# Include{prometheusRule} # Include{advanced} # Include{addons} # Include{codeserver} diff --git a/charts/stable/ntfy/values.yaml b/charts/stable/ntfy/values.yaml index 4ae9a7c4f10..8ead147fbfe 100644 --- a/charts/stable/ntfy/values.yaml +++ b/charts/stable/ntfy/values.yaml @@ -50,6 +50,7 @@ workload: ENABLE_CACHE_FILE: false ENABLE_ATTACHMENT_CACHE_DIR: false ENABLE_AUTH_FILE: false + NTFY_ENABLE_METRICS: "{{ .Values.metrics.main.enabled }}" # NTFY_CACHE_DURATION: "12h" # NTFY_KEEPALIVE_INTERVAL: "45s" # NTFY_MANAGER_INTERVAL: "1m" @@ -76,3 +77,31 @@ workload: envFrom: - configMapRef: name: "ntfy" + +metrics: + main: + # -- Enable and configure a Prometheus serviceMonitor for the chart under this key. + # @default -- See values.yaml + enabled: false + type: "servicemonitor" + endpoints: + - port: main + path: /metrics + # -- Enable and configure Prometheus Rules for the chart under this key. + # @default -- See values.yaml + prometheusRule: + enabled: false + labels: {} + # -- Configure additionial rules for the chart under this key. + # @default -- See prometheusrules.yaml + rules: + [] + # - alert: UnifiPollerAbsent + # annotations: + # description: Unifi Poller has disappeared from Prometheus service discovery. + # summary: Unifi Poller is down. + # expr: | + # absent(up{job=~".*unifi-poller.*"} == 1) + # for: 5m + # labels: + # severity: critical