Use this skill when the user wants a list of disk-full alerts for servers from monitoring readings (host, minute, usedPercent), e.g. 'which hosts have warning or critical disk usage', 'build disk-alerts.csv from input.json'. Not for CPU/memory alerts or general CSV conversion.
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-d0854521)
---
name: disk-alerts
description: "Use this skill when the user wants a list of disk-full alerts for servers from monitoring readings (host, minute, usedPercent), e.g. 'which hosts have warning or critical disk usage', 'build disk-alerts.csv from input.json'. Not for CPU/memory alerts or general CSV conversion."
---
# Disk alerts
Turn per-host disk usage readings into a CSV of hosts that currently need attention.
## Inputs
- `input.json` in the working folder: `{"readings": [{"host": string, "minute": int, "usedPercent": int 0-100}, ...]}`. Readings may arrive in any order.
- If `input.json` is missing or has no `readings` array, stop and tell the user; do not invent data.
## Rules
1. **Current state per host**: for each host, use only its reading with the greatest `minute`. Earlier readings are ignored, even if higher (a host that peaked and recovered is not alerted). Arrival order does not matter. If a host has two readings with the same greatest `minute`, use the one that appears later in the file.
2. **Level** from that reading's `usedPercent` (p):
- p >= 90 → `critical`
- 80 <= p <= 89 → `warning`
- p < 80 (including 0) → no alert, omit the host
Thresholds are inclusive: 90 is critical, 80 is warning.
3. **Order rows** by `usedPercent` descending, ties broken by `host` ascending (plain character-code comparison, so `app-02` before `ci-05`). Since critical implies a higher percent than warning, criticals come first naturally.
4. Host names are copied exactly as given (no trimming or case changes).
## Steps
1. Read `input.json`.
2. Build, per host, the reading with the max `minute` (rule 1).
3. Drop hosts with p < 80; assign levels.
4. Sort (rule 3).
5. Write `disk-alerts.csv` beside `input.json`, overwriting any existing file.
## Output format
- First line exactly: `host,level,used_percent`
- Then one line per alert: `host,level,usedPercent` (integer, no quotes, no spaces).
- Use `\n` line endings, with a trailing newline after the last line.
- If no host qualifies, the file contains only the header line.
## Worked example
Readings: web-03@0=72, db-01@0=93, cache-02@5=80, web-03@5=86, log-04@5=79, db-01@10=84.
Latest per host: web-03=86, db-01=84, cache-02=80, log-04=79. log-04 is dropped (<80). Result:
```csv
host,level,used_percent
web-03,warning,86
db-01,warning,84
cache-02,warning,80
```
## Ambiguity
- Missing fields on a reading: skip that reading and mention it to the user.
- Do not run scripts; do the computation by reading and writing the files directly, and double-check each host's maximum minute before writing.