Use this skill when the user wants a list of disk-full alerts for servers from monitoring readings (host, minute, usedPercent in input.json), e.g. 'which hosts have disks nearly full', 'make disk alerts', 'warning/critical disk usage CSV'. Produces disk-alerts.csv. Not for CPU/memory alerts or time-series trend reports.
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-8db58f36)
---
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 in input.json), e.g. 'which hosts have disks nearly full', 'make disk alerts', 'warning/critical disk usage CSV'. Produces disk-alerts.csv. Not for CPU/memory alerts or time-series trend reports."
---
# Disk alerts
Turn `input.json` (disk-usage readings) into `disk-alerts.csv` in the same folder. Work by reading and writing files only; no commands are needed.
## Input
`input.json` in the working folder: `{"readings": [{"host": string, "minute": int, "usedPercent": int 0-100}, ...]}`. Readings may arrive in any order and hosts repeat. If the file or `readings` is missing, tell the user and stop; do not invent data.
## Rules
1. **Latest reading per host.** For each host keep only the reading with the highest `minute` (NOT the last in the file). If a host has two readings with the same highest minute, use the one that appears later in the file. Earlier readings are ignored, even if they were higher.
2. **Level from that latest `usedPercent` (p):**
- `p >= 90` → `critical`
- `80 <= p <= 89` → `warning`
- `p < 80` (including 0) → no alert; omit the host.
3. **Sort** alerts by `used_percent` descending, then ties by `host` ascending (plain character-by-character comparison, so `app-02` before `ci-05`). Critical rows therefore come before warning rows automatically.
4. Host names are used as-is (no trimming/case change). Each host appears at most once.
## Output
Write `disk-alerts.csv` beside `input.json`, overwriting any existing file:
- First line exactly: `host,level,used_percent`
- One line per alert: `<host>,<level>,<p>` with p as a plain integer.
- Comma separators, `\n` line endings, trailing newline, no spaces, no quotes.
- If no host qualifies, write only the header line.
## Steps
1. Read `input.json`.
2. List each distinct host with its latest reading (rule 1); write this down explicitly.
3. Classify each (rule 2), drop non-alerts.
4. Sort (rule 3).
5. Write the CSV, then re-read it and check: header correct, row count equals the number of qualifying hosts, order correct.
## 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: web-03=86, db-01=84 (the 93 is superseded), cache-02=80, log-04=79 (no alert).
```csv
host,level,used_percent
web-03,warning,86
db-01,warning,84
cache-02,warning,80
```
## Ambiguity
Out-of-range or missing fields: skip unusable readings (no host, no numeric minute or percent) and mention it in your reply. Otherwise follow the rules above without asking.