Added smartctl exporter.

This commit is contained in:
Joseph Hanson 2024-02-29 11:23:50 -06:00
parent 19c57a2cc4
commit 2cd41cd98a
5 changed files with 133 additions and 1 deletions

View file

@ -10,7 +10,7 @@ resources:
# - ./grafana/ks.yaml
- ./kube-prometheus-stack/ks.yaml
- ./loki/ks.yaml
# - ./smartctl-exporter/ks.yaml
- ./smartctl-exporter/ks.yaml
# - ./snmp-exporter/ks.yaml
- ./thanos/ks.yaml
# - ./unpoller/ks.yaml

View file

@ -0,0 +1,37 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: &app smartctl-exporter
spec:
interval: 30m
chart:
spec:
chart: prometheus-smartctl-exporter
version: 0.7.1
sourceRef:
kind: HelmRepository
name: prometheus-community
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
uninstall:
keepHistory: false
dependsOn:
- name: kube-prometheus-stack
namespace: observability
values:
fullnameOverride: *app
config:
devices:
- /dev/sda
serviceMonitor:
enabled: true
prometheusRules:
enabled: false

View file

@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./prometheusrule.yaml

View file

@ -0,0 +1,67 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/monitoring.coreos.com/prometheusrule_v1.json
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: smartctl-exporter-rules
spec:
groups:
- name: smartctl-exporter.rules
rules:
- alert: SmartDeviceHighTemperature
annotations:
summary: Mounted drive {{ $labels.device }} on device {{ $labels.instance }}
has a temperature higher than 65°C.
expr: smartctl_device_temperature > 65
for: 15m
labels:
severity: critical
- alert: SmartDeviceTestFailed
annotations:
summary: Mounted drive {{ $labels.device }} on device {{ $labels.instance }}
did not pass its SMART test.
expr: |
(
smartctl_device_smart_status != 1
or
smartctl_device_status != 1
)
for: 15m
labels:
severity: critical
- alert: SmartDeviceCriticalWarning
annotations:
summary: Mounted drive {{ $labels.device }} on device {{ $labels.instance }}
is in a critical state.
expr: smartctl_device_critical_warning != 0
for: 15m
labels:
severity: critical
#
# Ref: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus-smartctl-exporter/rules/rules.txt
#
- alert: SmartDeviceMediaErrors
annotations:
summary: Mounted drive {{ $labels.device }} on device {{ $labels.instance }}
has media errors.
expr: smartctl_device_media_errors != 0
for: 15m
labels:
severity: critical
- alert: SmartDeviceAvailableSpareUnderThreadhold
annotations:
summary: Device {{ $labels.device }} on instance {{ $labels.instance }}
is under available spare threashold.
expr: smartctl_device_available_spare_threshold > smartctl_device_available_spare
for: 15m
labels:
severity: critical
- alert: SmartDeviceInterfaceSlow
annotations:
summary: Device {{ $labels.device }} on instance {{ $labels.instance }}
interface is slower then it should be.
expr: |
smartctl_device_interface_speed{speed_type="current"} != on(device, instance, namespace, pod) smartctl_device_interface_speed{speed_type="max"}
for: 15m
labels:
severity: critical

View file

@ -0,0 +1,21 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app smartctl-exporter
namespace: flux-system
spec:
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: *app
path: ./kubernetes/apps/observability/smartctl-exporter/app
prune: true
sourceRef:
kind: GitRepository
name: homelab
wait: false
interval: 30m
retryInterval: 1m
timeout: 5m