Cluster alert needs network evidence; flapping NICs count once #59

Merged
jared merged 1 commits from fix/no-network-without-evidence into main 2026-11-23 23:37:28 -05:00
Owner

Closes #57.

Why

On 2026-11-23, an OOM loop on compute-storage-01 stalled Ceph and timed out one node_exporter scrape on three hosts. Every switch link stayed up, and Gandalf still opened a P1 "Multiple hosts reporting interface failures" on a single poll (Tinker 615797777).

What changes (all in _process_interfaces, plus the new _check_cluster)

  • One missed scrape no longer counts. A host with no metrics counts toward the cluster check only after failure_threshold checks (2 polls, about 4 min).

  • Network evidence is required. The cluster P1 needs one of:

    • a NIC that went link-down
    • a missing host whose switch ports aren't all visibly up in UniFi

    Unknown wiring, a switch Gandalf can't see, or a missing port all count as evidence, so a real outage is never explained away.

  • Without evidence, no ticket. Gandalf records a cluster_hosts_stalled warning with no ticket. It reads "...every switch link to them stayed up: not a network fault. Check host memory, storage and load." It adds "OOM kills in the last 15 min on X" from node_vmstat_oom_kill when that applies. Host health stays with hwmonDaemon (#39) and later thor.

  • No P1 from one poll. The cluster ticket waits for failure_threshold consecutive checks, like every other alert. It used to ticket as soon as the event was new.

  • Flapping NICs count once. A NIC that drops 3 or more times within an hour (fresh drops only, not every check of one long outage) is flapping:

    • It keeps one open interface_down alert ("is flapping (link keeps dropping)").
    • Coming back up doesn't close that alert until an hour passes with no drops.
    • It doesn't count toward the cluster check.

Replayed against last night, none of these fire: one-scrape timeouts don't count, and the switch links were up anyway.

Prod data, already done: monitor-01 enp3s0 (a dead r8169 NIC) is marked unused, with the reason recorded.

Tests

  • TestClusterNeedsNetworkEvidence:
    • one missed scrape
    • a stall with links up (warning plus the OOM note, no ticket)
    • switch port down (ticket)
    • unknown wiring (ticket)
    • waiting for a second check
    • link regressions still ticket
  • TestFlappingInterface:
    • 3 drops in an hour is flapping, and up doesn't resolve it
    • excluded from the cluster count
    • one long outage is not flapping
    • settles after an hour

Results: 613 passed; flake8 and bandit clean; no em or en dashes. The README Alert Logic and config table are updated.

🤖 Generated with Claude Code

Closes #57. ## Why On 2026-11-23, an OOM loop on compute-storage-01 stalled Ceph and timed out **one** node_exporter scrape on three hosts. Every switch link stayed up, and Gandalf still opened a P1 "Multiple hosts reporting interface failures" on a single poll (Tinker 615797777). ## What changes (all in `_process_interfaces`, plus the new `_check_cluster`) - **One missed scrape no longer counts.** A host with no metrics counts toward the cluster check only after `failure_threshold` checks (2 polls, about 4 min). - **Network evidence is required.** The cluster P1 needs one of: - a NIC that went link-down - a missing host whose switch ports aren't all visibly up in UniFi Unknown wiring, a switch Gandalf can't see, or a missing port all count as evidence, so a real outage is never explained away. - **Without evidence, no ticket.** Gandalf records a `cluster_hosts_stalled` **warning** with no ticket. It reads "...every switch link to them stayed up: not a network fault. Check host memory, storage and load." It adds "OOM kills in the last 15 min on X" from `node_vmstat_oom_kill` when that applies. Host health stays with hwmonDaemon (#39) and later thor. - **No P1 from one poll.** The cluster ticket waits for `failure_threshold` consecutive checks, like every other alert. It used to ticket as soon as the event was new. - **Flapping NICs count once.** A NIC that drops 3 or more times within an hour (fresh drops only, not every check of one long outage) is flapping: - It keeps one open `interface_down` alert ("is flapping (link keeps dropping)"). - Coming back up doesn't close that alert until an hour passes with no drops. - It doesn't count toward the cluster check. Replayed against last night, none of these fire: one-scrape timeouts don't count, and the switch links were up anyway. **Prod data, already done:** monitor-01 `enp3s0` (a dead r8169 NIC) is marked unused, with the reason recorded. ## Tests - `TestClusterNeedsNetworkEvidence`: - one missed scrape - a stall with links up (warning plus the OOM note, no ticket) - switch port down (ticket) - unknown wiring (ticket) - waiting for a second check - link regressions still ticket - `TestFlappingInterface`: - 3 drops in an hour is flapping, and up doesn't resolve it - excluded from the cluster count - one long outage is not flapping - settles after an hour Results: 613 passed; flake8 and bandit clean; no em or en dashes. The README Alert Logic and config table are updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-23 23:34:51 -05:00
Cluster alert needs network evidence; flapping NICs count once
Lint / JS (eslint) (push) Successful in 13s
Lint / Python (flake8) (push) Successful in 1m7s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m8s
Test / Python Tests (pytest) (push) Successful in 1m23s
Lint / Python (flake8) (pull_request) Successful in 1m9s
Lint / JS (eslint) (pull_request) Successful in 32s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m37s
Test / Python Tests (pytest) (pull_request) Successful in 1m53s
7abe611adb
A host OOM stall on 2026-11-23 timed out one scrape on three hosts while
every switch link stayed up, and Gandalf opened a P1 network ticket on a
single poll (Tinker 615797777).

- A missing host counts toward the cluster check only after
  failure_threshold checks, not one missed scrape.
- The cluster P1 needs network evidence: a NIC link-down, or a missing
  host whose switch ports aren't all visibly up (unknown wiring counts as
  evidence). Without it, record a cluster_hosts_stalled warning with no
  ticket, naming hosts with recent OOM kills.
- The cluster ticket waits for consecutive checks like every other alert.
- A NIC that drops 3+ times in an hour is flapping: one standing alert,
  excluded from the cluster count.

Closes #57

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared merged commit bba483bb05 into main 2026-11-23 23:37:28 -05:00
jared deleted branch fix/no-network-without-evidence 2026-11-23 23:37:53 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/gandalf#59