Skip to content

Instantly share code, notes, and snippets.

@audomsak
Created July 22, 2025 10:28
Show Gist options
  • Select an option

  • Save audomsak/e9c1b14b94b06d13d03649b5cb76b308 to your computer and use it in GitHub Desktop.

Select an option

Save audomsak/e9c1b14b94b06d13d03649b5cb76b308 to your computer and use it in GitHub Desktop.
Prometheus Rule for Pod with high disk usage detection
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: pod-with-high-disk-usage
namespace: openshift-monitoring
spec:
groups:
- name: PodWithHighDiskUsage
rules:
- alert: PodWithHighDiskUsageWarning
expr: sum(container_fs_usage_bytes{pod != ""}) by (node, namespace, pod) / 1073741824 > 1
for: 1m
labels:
severity: 'warning'
annotations:
description: 'A {{ $labels.pod }} pod with filesystem (disk) usage about {{ $value | printf "%.2f" }} GB is found in the {{ $labels.namespace }} namespace on the {{$labels.node}} node.'
summary: 'A pod with filesystem (disk) usage more than 1 GB is found.'
- alert: PodWithHighDiskUsageCritical
expr: sum(container_fs_usage_bytes{pod != ""}) by (node, namespace, pod) / 1073741824 > 3
for: 1m
labels:
severity: 'critical'
annotations:
description: 'A {{ $labels.pod }} pod with filesystem (disk) usage about {{ $value | printf "%.2f" }} GB is found in the {{ $labels.namespace }} namespace on the {{$labels.node}} node.'
summary: 'A pod with filesystem (disk) usage more than 3 GB is found.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment