Gateway reachability from each host, taken over from hwmonDaemon (#66 item 7) #79

Open
jared wants to merge 1 commits from gateway-reachability into main
pull from: gateway-reachability
Owner

#66 item 7: network is Gandalf's to ticket, so hwmonDaemon's "Management network is unreachable" and "Ceph network is unreachable" checks move here.

How it works

  • Collection: each check, the SSH session Gandalf already opens on every host through Pulse (for ethtool) also pings each gateway in monitor.reachability 3 times, 0.2 s apart. That's about 0.4 s per gateway, with no extra SSH session.
    "reachability": {"management": "10.10.10.1", "ceph": "10.10.90.1"}
    
    Names must match [a-z0-9_-] and addresses must be IPv4. Anything else is ignored with a warning, so nothing unvalidated reaches the remote shell.
  • Alert: when all 3 pings are lost, Gandalf raises network_unreachable (target the host, detail the network).
    • Partial loss doesn't alert.
    • If the SSH collection failed for a host, that host has no result this check, so it neither alerts nor clears.
  • Ticket: a P2 after failure_threshold checks in a row. hwmonDaemon sent one ping and ticketed on a single miss.
    • One host: keyed host:<host>:ceph_net_unreachable or host:<host>:mgmt_net_unreachable. These are hwmonDaemon's own keys, so its open tickets carry on rather than being duplicated.
    • Several hosts losing the same network in one check: one cluster-wide ticket listing them all (cluster:<network>_net:unreachable), since the switch, VLAN or router is the likely cause. This avoids the one-ticket-per-host flood the Thor contract was written to stop.
    • It doesn't ask Thor first: this is network evidence, so the ticket is Gandalf's.
  • Stored: results go in link_stats.reachability.

Checked

  • On real hosts: I ran the exact ping on all six hosts. Both gateways answer (0% loss), the output matches the parser, and it takes 0.41 s per gateway with -i 0.2.
  • 11 new tests:
    • parsing, including busybox's wording and "Network is unreachable" output;
    • ping sections kept separate from interfaces;
    • target validation, including a shell-injection attempt;
    • the SSH command;
    • one host using hwmonDaemon's keys, for both networks;
    • several hosts sharing one ticket;
    • partial loss and a first failure don't ticket;
    • suppression, or an existing ticket, stops a new one;
    • no result means no change.
  • Overall: 782 pass on Python 3.13; flake8, bandit and the dash check are clean.

After merge

  1. Turn it on: add monitor.reachability (above) to prod's config.json and restart the monitor. Without it, nothing changes.
  2. After a clean day, set NETWORK_ENABLED=false in /etc/hwmonDaemon/.env on each host (hwmonDaemon#42's switch), so the check has only one owner.

🤖 Generated with Claude Code

#66 item 7: network is Gandalf's to ticket, so hwmonDaemon's "Management network is unreachable" and "Ceph network is unreachable" checks move here. ## How it works - **Collection:** each check, the SSH session Gandalf already opens on every host through Pulse (for ethtool) also pings each gateway in `monitor.reachability` 3 times, 0.2 s apart. That's about 0.4 s per gateway, with no extra SSH session. ```json "reachability": {"management": "10.10.10.1", "ceph": "10.10.90.1"} ``` Names must match `[a-z0-9_-]` and addresses must be IPv4. Anything else is ignored with a warning, so nothing unvalidated reaches the remote shell. - **Alert:** when all 3 pings are lost, Gandalf raises `network_unreachable` (target the host, detail the network). - Partial loss doesn't alert. - If the SSH collection failed for a host, that host has no result this check, so it neither alerts nor clears. - **Ticket:** a P2 after `failure_threshold` checks in a row. hwmonDaemon sent one ping and ticketed on a single miss. - **One host:** keyed `host:<host>:ceph_net_unreachable` or `host:<host>:mgmt_net_unreachable`. These are **hwmonDaemon's own keys**, so its open tickets carry on rather than being duplicated. - **Several hosts losing the same network in one check:** one cluster-wide ticket listing them all (`cluster:<network>_net:unreachable`), since the switch, VLAN or router is the likely cause. This avoids the one-ticket-per-host flood the Thor contract was written to stop. - It doesn't ask Thor first: this is network evidence, so the ticket is Gandalf's. - **Stored:** results go in `link_stats.reachability`. ## Checked - **On real hosts:** I ran the exact ping on all six hosts. Both gateways answer (0% loss), the output matches the parser, and it takes 0.41 s per gateway with `-i 0.2`. - **11 new tests:** - parsing, including busybox's wording and "Network is unreachable" output; - ping sections kept separate from interfaces; - target validation, including a shell-injection attempt; - the SSH command; - one host using hwmonDaemon's keys, for both networks; - several hosts sharing one ticket; - partial loss and a first failure don't ticket; - suppression, or an existing ticket, stops a new one; - no result means no change. - **Overall:** 782 pass on Python 3.13; flake8, bandit and the dash check are clean. ## After merge 1. **Turn it on:** add `monitor.reachability` (above) to prod's `config.json` and restart the monitor. Without it, nothing changes. 2. **After a clean day,** set `NETWORK_ENABLED=false` in `/etc/hwmonDaemon/.env` on each host (hwmonDaemon#42's switch), so the check has only one owner. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-29 03:44:52 -05:00
Gateway reachability from each host, taken over from hwmonDaemon (#66 item 7)
CI / Lint (JS) (pull_request) Successful in 14s
CI / Lint (Python) (pull_request) Successful in 41s
CI / Test (pull_request) Successful in 1m8s
CI / Security (pull_request) Successful in 42s
CI / Scan (pull_request) Successful in 21s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
c9919017dc
The SSH session Gandalf already opens on each host through Pulse (for
ethtool) now also pings each gateway in monitor.reachability 3 times,
0.2 s apart, e.g. {"management": "10.10.10.1", "ceph": "10.10.90.1"}.

- All 3 lost raises network_unreachable (host, network); partial loss
  doesn't, and a host whose SSH collection failed neither alerts nor
  clears. A P2 ticket after failure_threshold checks in a row, where
  hwmonDaemon pinged once and ticketed on a single miss.
- One host: hwmonDaemon's own keys (host:<host>:ceph_net_unreachable,
  host:<host>:mgmt_net_unreachable), so its open tickets carry on.
- Several hosts losing the same network in one check share one
  cluster-wide ticket (cluster:<network>_net:unreachable): the switch,
  VLAN or router is the likely cause, not each host.
- Results are kept in link_stats.reachability.

Checked from all six hosts: both gateways answer, and the output parses.
hwmonDaemon's NETWORK_ENABLED switch turns its version off once this is
live with monitor.reachability set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
All checks were successful
CI / Lint (JS) (pull_request) Successful in 14s
Required
Details
CI / Lint (Python) (pull_request) Successful in 41s
Required
Details
CI / Test (pull_request) Successful in 1m8s
Required
Details
CI / Security (pull_request) Successful in 42s
Required
Details
CI / Scan (pull_request) Successful in 21s
Required
Details
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin gateway-reachability:gateway-reachability
git checkout gateway-reachability
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#79