|
| 1 | +{{- if .Values.metrics.rules.enabled }} |
| 2 | +{{- $fullname := include "nextcloud.fullname" . }} |
| 3 | +apiVersion: monitoring.coreos.com/v1 |
| 4 | +kind: PrometheusRule |
| 5 | +metadata: |
| 6 | + name: {{ $fullname }} |
| 7 | + labels: |
| 8 | + {{- include "nextcloud.labels" ( dict "rootContext" $ ) | nindent 4 }} |
| 9 | + {{- with .Values.metrics.rules.labels }} |
| 10 | + {{- toYaml . | nindent 4 }} |
| 11 | + {{- end }} |
| 12 | +spec: |
| 13 | + groups: |
| 14 | + {{- with .Values.metrics.rules.defaults }} |
| 15 | + {{- if .enabled }} |
| 16 | + {{- $filter := .filter | default (printf `namespace="%s",job="%s"` $.Release.Namespace $fullname) }} |
| 17 | + - name: {{ $fullname }}-Defaults |
| 18 | + rules: |
| 19 | + - alert: "nextcloud: not reachable" |
| 20 | + expr: 'avg(nextcloud_up{ {{ $filter }} }) without(endpoint,container,pod,instance) < 1' |
| 21 | + for: 5m |
| 22 | + labels: |
| 23 | + severity: "critical" |
| 24 | + {{- with .labels }} |
| 25 | + {{- toYaml . | nindent 12 }} |
| 26 | + {{- end }} |
| 27 | + annotations: |
| 28 | + {{` |
| 29 | + summary: "Nextcloud in {{ $labels.namespace }} is not reachable by exporter" |
| 30 | + `}} |
| 31 | + - alert: "nextcloud: outdated version" |
| 32 | + expr: 'sum(nextcloud_system_update_available{ {{ $filter }} }) without(endpoint,container,pod,instance) > 0' |
| 33 | + labels: |
| 34 | + severity: "warning" |
| 35 | + {{- with .labels }} |
| 36 | + {{- toYaml . | nindent 12 }} |
| 37 | + {{- end }} |
| 38 | + annotations: |
| 39 | + {{` |
| 40 | + summary: "Nextcloud in {{ $labels.namespace }} is outdated" |
| 41 | + `}} |
| 42 | + - alert: "nextcloud: outdated apps" |
| 43 | + expr: 'sum(nextcloud_apps_updates_available_total{ {{ $filter }} }) without(endpoint,container,pod,instance) > 0' |
| 44 | + labels: |
| 45 | + severity: "warning" |
| 46 | + {{- with .labels }} |
| 47 | + {{- toYaml . | nindent 12 }} |
| 48 | + {{- end }} |
| 49 | + annotations: |
| 50 | + {{` |
| 51 | + summary: "Nextcloud in {{ $labels.namespace }} has {{ $value }} outdated Apps" |
| 52 | + `}} |
| 53 | + {{- end }} |
| 54 | + {{- end }}{{/* end-with prometheus.rules.default */}} |
| 55 | + {{- with .Values.metrics.rules.additionalRules }} |
| 56 | + - name: {{ $fullname }}-Additional |
| 57 | + rules: |
| 58 | + {{- toYaml . | nindent 8 }} |
| 59 | + {{- end }} |
| 60 | +{{- end }} |
| 61 | +
|
0 commit comments