← Recipes
Monitoring & alerting
Alert when disk usage is high
Check filesystem utilization on a schedule and notify Slack before a disk fills up.
Supported platforms
LinuxmacOS
Prerequisites
- df and awk
- A Slack incoming webhook URL exposed through an environment-backed Dagu secret
Workflow YAML
description: Notify Slack when a filesystem reaches its utilization threshold.
schedule: "*/15 * * * *"
params:
- name: path
default: /
- name: threshold_percent
type: integer
default: 85
minimum: 1
maximum: 100
secrets:
- name: SLACK_WEBHOOK_URL
provider: env
key: SLACK_WEBHOOK_URL
handler_on:
failure:
action: http.request
with:
method: POST
url: ${env.SLACK_WEBHOOK_URL}
headers:
Content-Type: application/json
body: '{"text":"Disk usage for ${params.path} reached the ${params.threshold_percent}% alert threshold on the Dagu host."}'
steps:
- id: check_usage
run: |
#!/bin/sh
set -eu
usage="$(df -P "${params.path}" | awk 'NR == 2 { gsub(/%/, "", $5); print $5 }')"
printf 'Disk usage for %s: %s%%\n' "${params.path}" "$usage"
test "$usage" -lt "${params.threshold_percent}"
Review before running
Replace example values, configure the listed secrets, and review every command for your environment. Syntax validation does not make a community workflow trusted.
Running this workflow with a team?
The Team plan adds SSO, role-based access, audit logs, incident routing, and priority support for three self-hosted Dagu servers. Start a 14-day trial without a credit card.
Start Team trial