do not offer the ballast on a dev machine, and route its alerts through one place
Servers only now. On a machine you sit at, a filling disk announces itself — the editor refuses to save, the browser complains — and you are there to deal with it. The reserve is for the box nobody is watching, where the first sign is a service that stopped working hours ago. Skipped rather than asked, but said out loud with the reason and recorded in the summary. A section that silently produces no output is indistinguishable from one that failed. The cron this section installs was already there and is unchanged: /etc/cron.d runs the checker as root every ten minutes, and it deletes the ballast when free space falls under the threshold. What changed is where its message goes. Both alerts now run through one notify() inside the generated checker rather than calling logger directly, so there is a single place to add a second channel. Today it is still syslog only — the message lands in the journal and nowhere else, so nobody learns about it until they go looking, which is precisely the wrong moment. Push, mail or Officer's own notify sidecar hook in there. It also echoes to stderr now, so running the checker by hand shows the message instead of appearing to do nothing. Verified: dev reports not-applicable and asks nothing, vps still asks and records a refusal, and the regenerated checker parses and reports status. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -272,16 +272,25 @@ if [[ "\${1:-}" == "--status" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Everything urgent goes through here, so there is one place to add a second
|
||||
# channel later. Today it is syslog only, which means the message is in the
|
||||
# journal and nowhere else — nobody finds out until they go looking, which is
|
||||
# exactly the wrong moment. Push, mail or Officer's own notify sidecar hook in
|
||||
# here.
|
||||
notify() {
|
||||
logger -t "\$TAG" -p user.crit "\$1"
|
||||
# A copy on stderr as well, so a human running this by hand sees it.
|
||||
echo "\$1" >&2
|
||||
}
|
||||
|
||||
((FREE_PCT < THRESHOLD)) || exit 0
|
||||
|
||||
if [[ -f "\$BALLAST" ]]; then
|
||||
FREED="\$(du -h "\$BALLAST" | cut -f1)"
|
||||
rm -f "\$BALLAST"
|
||||
logger -t "\$TAG" -p user.crit \\
|
||||
"Free space \${FREE_PCT}% below \${THRESHOLD}% — deleted ballast, reclaimed \${FREED}. CLEAN UP NOW: this valve is spent."
|
||||
notify "Free space \${FREE_PCT}% below \${THRESHOLD}% — deleted ballast, reclaimed \${FREED}. CLEAN UP NOW: this valve is spent."
|
||||
else
|
||||
logger -t "\$TAG" -p user.crit \\
|
||||
"Free space \${FREE_PCT}% below \${THRESHOLD}% — ballast already spent, no headroom left to reclaim."
|
||||
notify "Free space \${FREE_PCT}% below \${THRESHOLD}% — ballast already spent, no headroom left to reclaim."
|
||||
fi
|
||||
CHECKER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user