flux-charts/infra-fluxcd/templates/prometheus-rule.yaml

63 lines
2.8 KiB
YAML

---
{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule") }}
{{- $filter := "endpoint,instance,container,pod,namespace,job,service,chart_version,ready,customresource_group,customresource_version" }}
apiVersion: "monitoring.coreos.com/v1"
kind: "PrometheusRule"
metadata:
name: flux-system
labels:
{{- toYaml .Values.commons.prometheus.rules.labels | nindent 4 }}
spec:
groups:
- name: "FluxCD"
rules:
- alert: "FluxCD: source fetch failed"
expr: 'sum(gotk_resource_info{customresource_group="source.toolkit.fluxcd.io",ready!="True",ready=~".+"}) without ({{ $filter }}) > 0'
for: "5m"
labels:
severity: "warning"
{{`
namespace: "{{ $labels.exported_namespace }}"
annotations:
summary: "FluxCD has not fetched a source in {{ $labels.exported_namespace }} correct"
description: "FluxCD has not fetched the source {{ $labels.name }} of {{ $labels.kind }} in {{ $labels.exported_namespace }}"
`}}
- alert: "FluxCD: install failed"
expr: 'sum(gotk_resource_info{customresource_group!="source.toolkit.fluxcd.io",ready!="True"}) without ({{ $filter }}) > 0'
for: "5m"
labels:
severity: "warning"
{{`
namespace: "{{ $labels.exported_namespace }}"
annotations:
summary: "FluxCD has not installed something in {{ $labels.exported_namespace }} correct"
description: "FluxCD has not installed {{ $labels.name }} of {{ $labels.kind }} in {{ $labels.exported_namespace }} correct"
`}}
- name: "FluxCD - legacy"
rules:
- alert: "FluxCD: source fetch failed"
expr: 'gotk_reconcile_condition{status="False",kind=~"GitRepository|HelmRepository|HelmChart|Bucket"} > 0'
for: "5m"
labels:
severity: "warning"
{{`
namespace: "{{ $labels.exported_namespace }}"
annotations:
summary: "FluxCD has not fetched a source in {{ $labels.exported_namespace }} correct"
description: "FluxCD has not fetched the source {{ $labels.name }} of {{ $labels.kind }} in {{ $labels.exported_namespace }}"
`}}
- alert: "FluxCD: install failed"
expr: 'gotk_reconcile_condition{status="False",kind=~"Kustomization|HelmRelease"} > 0'
for: "5m"
labels:
severity: "warning"
{{`
namespace: "{{ $labels.exported_namespace }}"
annotations:
summary: "FluxCD has not installed something in {{ $labels.exported_namespace }} correct"
description: "FluxCD has not installed {{ $labels.name }} of {{ $labels.kind }} in {{ $labels.exported_namespace }} correct"
`}}
{{- end }}