mirror of https://git.rancher.io/charts
125 lines
6.1 KiB
YAML
125 lines
6.1 KiB
YAML
{{- /*
|
|
Generated from 'general.rules' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/a8ba97a150c75be42010c75d10b720c55e182f1a/manifests/kubePrometheus-prometheusRule.yaml
|
|
Do not change in-place! In order to change this file first read following link:
|
|
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
|
|
*/ -}}
|
|
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
|
|
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.general }}
|
|
apiVersion: monitoring.coreos.com/v1
|
|
kind: PrometheusRule
|
|
metadata:
|
|
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "general.rules" | trunc 63 | trimSuffix "-" }}
|
|
namespace: {{ template "kube-prometheus-stack.namespace" . }}
|
|
labels:
|
|
app: {{ template "kube-prometheus-stack.name" . }}
|
|
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
|
|
{{- if .Values.defaultRules.labels }}
|
|
{{ toYaml .Values.defaultRules.labels | indent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.defaultRules.annotations }}
|
|
annotations:
|
|
{{ toYaml .Values.defaultRules.annotations | indent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
groups:
|
|
- name: general.rules
|
|
rules:
|
|
{{- if not (.Values.defaultRules.disabled.TargetDown | default false) }}
|
|
- alert: TargetDown
|
|
annotations:
|
|
{{- if .Values.defaultRules.additionalRuleAnnotations }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleAnnotations | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.defaultRules.additionalRuleGroupAnnotations.general }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleGroupAnnotations.general | indent 8 }}
|
|
{{- end }}
|
|
description: '{{`{{`}} printf "%.4g" $value {{`}}`}}% of the {{`{{`}} $labels.job {{`}}`}}/{{`{{`}} $labels.service {{`}}`}} targets in {{`{{`}} $labels.namespace {{`}}`}} namespace are down.'
|
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}/general/targetdown
|
|
summary: One or more targets are unreachable.
|
|
expr: 100 * (count(up == 0) BY (cluster, job, namespace, service) / count(up) BY (cluster, job, namespace, service)) > 10
|
|
for: {{ dig "TargetDown" "for" "10m" .Values.customRules }}
|
|
{{- with .Values.defaultRules.keepFiringFor }}
|
|
keep_firing_for: "{{ . }}"
|
|
{{- end }}
|
|
labels:
|
|
severity: {{ dig "TargetDown" "severity" "warning" .Values.customRules }}
|
|
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- with .Values.defaultRules.additionalRuleLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if not (.Values.defaultRules.disabled.Watchdog | default false) }}
|
|
- alert: Watchdog
|
|
annotations:
|
|
{{- if .Values.defaultRules.additionalRuleAnnotations }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleAnnotations | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.defaultRules.additionalRuleGroupAnnotations.general }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleGroupAnnotations.general | indent 8 }}
|
|
{{- end }}
|
|
description: 'This is an alert meant to ensure that the entire alerting pipeline is functional.
|
|
|
|
This alert is always firing, therefore it should always be firing in Alertmanager
|
|
|
|
and always fire against a receiver. There are integrations with various notification
|
|
|
|
mechanisms that send a notification when this alert is not firing. For example the
|
|
|
|
"DeadMansSnitch" integration in PagerDuty.
|
|
|
|
'
|
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}/general/watchdog
|
|
summary: An alert that should always be firing to certify that Alertmanager is working properly.
|
|
expr: vector(1)
|
|
labels:
|
|
severity: {{ dig "Watchdog" "severity" "none" .Values.customRules }}
|
|
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- with .Values.defaultRules.additionalRuleLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if not (.Values.defaultRules.disabled.InfoInhibitor | default false) }}
|
|
- alert: InfoInhibitor
|
|
annotations:
|
|
{{- if .Values.defaultRules.additionalRuleAnnotations }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleAnnotations | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.defaultRules.additionalRuleGroupAnnotations.general }}
|
|
{{ toYaml .Values.defaultRules.additionalRuleGroupAnnotations.general | indent 8 }}
|
|
{{- end }}
|
|
description: 'This is an alert that is used to inhibit info alerts.
|
|
|
|
By themselves, the info-level alerts are sometimes very noisy, but they are relevant when combined with
|
|
|
|
other alerts.
|
|
|
|
This alert fires whenever there''s a severity="info" alert, and stops firing when another alert with a
|
|
|
|
severity of ''warning'' or ''critical'' starts firing on the same namespace.
|
|
|
|
This alert should be routed to a null receiver and configured to inhibit alerts with severity="info".
|
|
|
|
'
|
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}/general/infoinhibitor
|
|
summary: Info-level alert inhibition.
|
|
expr: ALERTS{severity = "info"} == 1 unless on ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}namespace) ALERTS{alertname != "InfoInhibitor", severity =~ "warning|critical", alertstate="firing"} == 1
|
|
labels:
|
|
severity: {{ dig "InfoInhibitor" "severity" "none" .Values.customRules }}
|
|
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- with .Values.defaultRules.additionalRuleLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.defaultRules.additionalRuleGroupLabels.general }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }} |