Skip to content

Commit

Permalink
add zfs state degrade rule in prometheus linuxaid
Browse files Browse the repository at this point in the history
  • Loading branch information
iminfinity committed Dec 3, 2024
1 parent 0ef419f commit b3e5b38
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
12 changes: 12 additions & 0 deletions argocd-helm-charts/prometheus-linuxaid/rules/zfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
groups:
- name: zfs::pool::status
rules:
- alert: zfs::pool::status
expr: node_zfs_zpool_state{state!="online"} > 0
for: 30m
labels:
severity: critical
alert_id: zfs::pool::status
annotations:
summary: 'ZFS Pool is Degraded.'
description: 'The zfs pool **{{ .Labels.zpool }}** is {{ .Labels.state }} on {{ .Labels.instance }}'
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- if .Values.prometheusRule.zfsExporter }}
{{- if .Values.prometheusRule.zfs }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: zfs-exporter-rules
name: zfs
namespace: monitoring-{{ .Values.customerid }}
spec:
{{- $.Files.Get "rules/zfs_exporter.yaml" | nindent 4 }}
{{- $.Files.Get "rules/zfs.yaml" | nindent 4 }}
{{- end }}
27 changes: 27 additions & 0 deletions argocd-helm-charts/prometheus-linuxaid/tests/zfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
evaluation_interval: 1m

rule_files:
- ../rules/zfs.yaml

tests:
- interval: 1m
input_series:
- series: obmondo_monitoring{alert_id="zfs::pool::status"}
values: 1x200
- series: node_zfs_zpool_state{state="degraded", instance="htzhel1-ax41a.enableit.dk", zpool="mypool"}
values: 1x200

alert_rule_test:
- alertname: 'zfs::pool::status'
eval_time: 30m
exp_alerts:
- exp_labels:
severity: 'critical'
instance: 'htzhel1-ax41a.enableit.dk'
alert_id: 'zfs::pool::status'
zpool: 'mypool'
state: 'degraded'
exp_annotations:
summary: 'ZFS Pool is Degraded.'
description: 'The zfs pool **mypool** is degraded on htzhel1-ax41a.enableit.dk'
1 change: 1 addition & 0 deletions argocd-helm-charts/prometheus-linuxaid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ prometheusRule:
ssacli: true
zfsExporter: true
smartmon_sata: true
zfs: true
alertmanager:
version: v0.27.0
config:
Expand Down

0 comments on commit b3e5b38

Please sign in to comment.