Turn a monitoring input.json (readings of {host, minute, usedPercent}) into disk-alerts.csv listing hosts whose current disk usage is at warning or critical level. Use whenever asked for disk alerts, disk-full alerts, or a disk-alerts.csv from server disk readings, even if the rule isn't spelled out.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Disk Alerts?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-disk-alerts-7d021197)
---
name: disk-alerts
description: Turn a monitoring input.json (readings of {host, minute, usedPercent}) into disk-alerts.csv listing hosts whose current disk usage is at warning or critical level. Use whenever asked for disk alerts, disk-full alerts, or a disk-alerts.csv from server disk readings, even if the rule isn't spelled out.
---
# Disk alerts
Read `input.json` in the working folder and write `disk-alerts.csv` in the same folder. Do the work by hand (no scripts needed); follow the steps exactly, because the rule below was derived from worked examples.
## Rule
1. **Use only each host's current reading.** For every host, find the reading with the largest `minute`. Ignore all of that host's earlier readings, even if they were higher (a host that hit 97 and later dropped to 91 is judged at 91; one that was 95 and later 61 gets no alert). Readings may arrive out of order, so compare `minute` values, not array positions. If two readings of a host share the largest minute, take the one listed later.
2. **Classify the current `usedPercent`:**
- 90 or more → `critical`
- 80 to 89 → `warning`
- below 80 → no alert; omit the host.
(Boundaries are inclusive: 90 is critical, 80 is warning, 79 is nothing.)
3. **Sort the alerts** by `used_percent` descending (highest first); break ties by `host` ascending in plain character order (e.g. `app-02` before `ci-05`). Critical hosts naturally come first.
## Output format
- First line exactly: `host,level,used_percent`
- Then one line per alerting host: `<host>,<level>,<current usedPercent>` — no spaces, no quotes, number as a plain integer.
- Use `\n` line endings and end the file with a trailing newline.
- If no host alerts, the file contains only the header line.
- One row per host, never duplicates.
## Procedure
1. Read input.json; list each distinct host.
2. For each host, pick the max-minute reading, noting its usedPercent.
3. Drop hosts below 80; label the rest.
4. Sort, then write the file. Re-check: every host appears at most once, values are from the latest minute, order is percent descending then host ascending.
## Worked check
Readings: gpu-01 (min 0: 97, min 30: 91), nfs-02 (0: 40, 30: 88, 60: 91) → both current 91 → critical; tie, so gpu-01 then nfs-02:
```
host,level,used_percent
gpu-01,critical,91
nfs-02,critical,91
```