fix(mycloud-nextcloud): improve metrics and alerts (workaround)

This commit is contained in:
WrenIX 2025-02-13 12:46:14 +01:00
parent d08028c2aa
commit 3b80a91678
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
2 changed files with 45 additions and 0 deletions

View file

@ -215,6 +215,11 @@ spec:
metrics:
enabled: true
image:
tag: 0.8.0
info:
apps: true
update: true
prometheus:
serviceMonitor:

View file

@ -0,0 +1,40 @@
{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule") }}
---
# workaround till https://github.com/nextcloud/helm/pull/694 is merged
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ .Release.Name }}
labels:
{{- toYaml .Values.commons.prometheus.rules.labels | nindent 4 }}
spec:
groups:
- name: {{ .Release.Name }}-Defaults
rules:
- alert: "nextcloud: not reachable"
expr: 'avg(nextcloud_last_update_seconds{ }) without(endpoint,container,pod,instance) < 1'
labels:
severity: "critical"
{{`
annotations:
summary: "Nextcloud in {{ $labels.namespace }} is not reachable by exporter"
`}}
- alert: "nextcloud: outdated version"
expr: 'sum(nextcloud_system_update_available{ }) without(endpoint,container,pod,instance) > 0'
labels:
severity: "warning"
{{`
annotations:
summary: "Nextcloud in {{ $labels.namespace }} is outdated"
`}}
- alert: "nextcloud: outdated apps"
expr: 'sum(nextcloud_apps_updates_available_total{ }) without(endpoint,container,pod,instance) > 0'
labels:
severity: "warning"
{{`
annotations:
summary: "Nextcloud in {{ $labels.namespace }} has {{ $value }} outdated Apps"
`}}
{{- end }}