homelab-audit.sh: Dynamic summary and --hosts filter #24

Closed
opened 2026-04-03 01:09:03 +00:00 by cal · 1 comment
Owner

Context

SRE review noted the audit script's summary section prints static hardcoded recommendations regardless of actual findings, and the script has no way to target specific hosts for post-fix validation.

Improvements

1. Dynamic summary driven by actual findings

The generate_summary function currently prints a generic checklist. It should instead:

  • Track findings during parse_and_report in an ISSUES_FOUND array (or temp file)
  • Count WARN and CRIT flags per host
  • Print only the issues that were actually found
  • Include per-host issue counts in the summary table
  • Show total findings: "X warnings, Y critical across Z hosts"

2. --hosts filter flag

  • Add --hosts vm-116,manticore argument to run the audit against specific hosts only
  • Skip Proxmox inventory when --hosts is specified (unless proxmox is in the list)
  • This enables targeted post-fix validation without waiting for the full audit run
  • Usage: homelab-audit.sh --hosts vm-115-docker-sba,manticore

3. Machine-readable output option

  • The --json flag is accepted but not implemented — consider outputting a JSON summary alongside the text report
  • Even a simple findings.json in $REPORT_DIR would be useful for n8n integration

Files

  • monitoring/scripts/homelab-audit.sh

Labels

infra-audit, script

## Context SRE review noted the audit script's summary section prints static hardcoded recommendations regardless of actual findings, and the script has no way to target specific hosts for post-fix validation. ## Improvements ### 1. Dynamic summary driven by actual findings The `generate_summary` function currently prints a generic checklist. It should instead: - [ ] Track findings during `parse_and_report` in an `ISSUES_FOUND` array (or temp file) - [ ] Count WARN and CRIT flags per host - [ ] Print only the issues that were actually found - [ ] Include per-host issue counts in the summary table - [ ] Show total findings: "X warnings, Y critical across Z hosts" ### 2. --hosts filter flag - [ ] Add `--hosts vm-116,manticore` argument to run the audit against specific hosts only - [ ] Skip Proxmox inventory when `--hosts` is specified (unless `proxmox` is in the list) - [ ] This enables targeted post-fix validation without waiting for the full audit run - [ ] Usage: `homelab-audit.sh --hosts vm-115-docker-sba,manticore` ### 3. Machine-readable output option - [ ] The `--json` flag is accepted but not implemented — consider outputting a JSON summary alongside the text report - [ ] Even a simple `findings.json` in `$REPORT_DIR` would be useful for n8n integration ## Files - `monitoring/scripts/homelab-audit.sh` ## Labels `infra-audit`, `script`
cal added the
infra-audit
script
labels 2026-04-03 01:10:19 +00:00
Claude added the
ai-working
label 2026-04-03 03:00:32 +00:00
Claude removed the
ai-working
label 2026-04-03 03:04:20 +00:00
Collaborator

PR #38 opened: #38

Approach:

  • --hosts vm-116,manticore: bypasses Proxmox inventory, SSHes directly to each named host; skips backup-recency check unless proxmox is listed
  • Per-host breakdown table added to generate_summary using the new AUDITED_HOSTS global array; only rows with at least one finding are printed
  • --json now writes $REPORT_DIR/findings.json via a Python inline heredoc — structured for n8n ingestion
  • Total: X warning(s), Y critical across Z host(s) line added at end of summary
PR #38 opened: https://git.manticorum.com/cal/claude-home/pulls/38 **Approach:** - `--hosts vm-116,manticore`: bypasses Proxmox inventory, SSHes directly to each named host; skips backup-recency check unless `proxmox` is listed - Per-host breakdown table added to `generate_summary` using the new `AUDITED_HOSTS` global array; only rows with at least one finding are printed - `--json` now writes `$REPORT_DIR/findings.json` via a Python inline heredoc — structured for n8n ingestion - `Total: X warning(s), Y critical across Z host(s)` line added at end of summary
Claude added the
ai-pr-opened
label 2026-04-03 03:04:26 +00:00
cal closed this issue 2026-04-03 20:22:25 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/claude-home#24
No description provided.