Host Alerts
This tool allows you to monitor your host's disk space and receive alerts when it falls below a specified threshold. The following configuration demonstrates how to set up an alert for low disk space on the root partition.
Configuration
Configure your alert rules using the following YAML configuration. This example sets up an alert for when disk space on the root partition falls below 10%.
groups:
- name: host_alerts.yml
rules:
# alert when disk has 10% of availlable space left
- alert: host_disk_space_low
expr: (node_filesystem_avail_bytes{mountpoint="/"} * 100) / node_filesystem_size_bytes{mountpoint="/"} < 10
for: 1m
labels:
severity: warning
alert_channel: slack
team: devops
annotations:
title: "Disk Usage is Low in {{ $labels.instance }}"
description: "Instance {{ $labels.instance }} disk usage for {{ $labels.mountpoint }} is at {{ humanize $value}}%."
summary: "\n- Node: {{ $labels.instance }} \n- Disk Usage: {{ humanize $value}}%"
Alerting
This configuration uses Slack as the alerting channel. You can customize this to send alerts via email, PagerDuty, or other integrations. Ensure your Alertmanager is properly configured to route alerts to your desired channel.
Customization
You can adjust the expr to monitor different mount points or thresholds. The for parameter specifies the duration the condition must be met before triggering an alert. Modify the labels to suit your team's alerting policies.
Further Reading
For more information on Prometheus alerting and configuration, refer to the official documentation:
Understanding Prometheus Query Language (PromQL)
The expr field uses PromQL, Prometheus' query language. Understanding PromQL is crucial for creating effective alerts. Here are some resources to help you learn PromQL: