Skip to content

Commit

Permalink
Add switch to enable/disable alert-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Stian Haugland committed Mar 5, 2021
1 parent 5332d16 commit 2e53277
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions node-dns-exporter/templates/alert-rules.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{{- if .Values.metrics.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "node-dns-exporter.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "node-dns-exporter.labels" . | nindent 4 }}
alertmanager: {{ .Values.alertManager | default "default" }}
spec:
groups:
- name: nodeDNS
- name: NodeDNS
rules:
- alert: NodeDNSerror
annotations:
Expand All @@ -17,6 +19,7 @@ spec:
for: {{ .Values.alertFor | default "3m" }}
labels:
serverity: warning
{{- if .Values.alertRules }}
{{ toYaml .Values.alertRules | indent 4 }}
{{- if .Values.customAlertRules }}
{{ toYaml .Values.customAlertRules | indent 4 }}
{{- end }}
{{- end }}
9 changes: 7 additions & 2 deletions node-dns-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,17 @@ nodeDns:

alertFor: #3m

alertRules: []
# Sets the alertmanager instance as a label
# in case the chart is deployed in an environment with
# multiple alertmanager instances
alertManager: #default

customAlertRules: []
# - alert: something
# annotations:
# message: |-
# {{` something is not working `}}
# expr: ''
# for: 10m
# labels:
# severity: warning
# severity: warning

0 comments on commit 2e53277

Please sign in to comment.