From 280e786b7366821368bf657577106f18adf52bc0 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 31 Jan 2026 10:03:38 -0800 Subject: [PATCH] Mark config-only nodes as unreachable when they have no IPs Co-Authored-By: Claude Opus 4.5 --- .claude/settings.local.json | 3 ++- config.yaml | 16 ++++++++++++++++ ping.go | 9 +++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 680c775..423a19e 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -91,7 +91,8 @@ "Bash(du:*)", "Bash(tree:*)", "Bash(go get:*)", - "Bash(go test:*)" + "Bash(go test:*)", + "Bash(git stash:*)" ], "ask": [ "Bash(rm *)" diff --git a/config.yaml b/config.yaml index aaa94db..a23d098 100644 --- a/config.yaml +++ b/config.yaml @@ -6,27 +6,35 @@ locations: nodes: - names: ["lighting-2"] - names: ["Pixie Driver 8k 2 Port 1"] + ips: ["10.50.1.72"] macs: ["48:59:00:41:00:29"] avoid: true - names: ["Pixie Driver 8k 2 Port 2"] + ips: ["10.50.1.73"] macs: ["48:59:00:28:00:27"] avoid: true - names: ["Pixie Driver 8k 2 Port 3"] + ips: ["10.50.1.74"] macs: ["48:59:00:43:00:29"] avoid: true - names: ["Pixie Driver 8k 2 Port 4"] + ips: ["10.50.1.75"] macs: ["48:59:00:42:00:29"] avoid: true - names: ["Pixie Driver 8k 2 Port 5"] + ips: ["10.50.1.76"] macs: ["48:59:00:3c:00:3e"] avoid: true - names: ["Pixie Driver 8k 2 Port 6"] + ips: ["10.50.1.77"] macs: ["48:59:00:3f:00:3e"] avoid: true - names: ["Pixie Driver 8k 2 Port 7"] + ips: ["10.50.1.78"] macs: ["48:59:00:25:00:3e"] avoid: true - names: ["Pixie Driver 8k 2 Port 8"] + ips: ["10.50.1.79"] macs: ["48:59:00:41:00:3e"] avoid: true - names: ["DMXG"] # cyc1 @@ -71,27 +79,35 @@ locations: nodes: - names: ["lighting-1"] - names: ["Pixie Driver 8k 1 Port 1"] + ips: ["10.50.1.64"] macs: ["48:59:00:27:00:27"] avoid: true - names: ["Pixie Driver 8k 1 Port 2"] + ips: ["10.50.1.65"] macs: ["48:59:00:37:00:27"] avoid: true - names: ["Pixie Driver 8k 1 Port 3"] + ips: ["10.50.1.66"] macs: ["48:59:00:3e:00:27"] avoid: true - names: ["Pixie Driver 8k 1 Port 4"] + ips: ["10.50.1.67"] macs: ["48:59:00:3f:00:27"] avoid: true - names: ["Pixie Driver 8k 1 Port 5"] + ips: ["10.50.1.68"] macs: ["48:59:00:47:00:1a"] avoid: true - names: ["Pixie Driver 8k 1 Port 6"] + ips: ["10.50.1.69"] macs: ["48:59:00:44:00:1a"] avoid: true - names: ["Pixie Driver 8k 1 Port 7"] + ips: ["10.50.1.70"] macs: ["48:59:00:42:00:19"] avoid: true - names: ["Pixie Driver 8k 1 Port 8"] + ips: ["10.50.1.71"] macs: ["48:59:00:44:00:19"] avoid: true diff --git a/ping.go b/ping.go index a75bbd8..9c52025 100644 --- a/ping.go +++ b/ping.go @@ -158,6 +158,15 @@ func (t *Tendrils) pingNode(node *Node) { t.nodes.mu.RUnlock() if len(ips) == 0 { + t.ping.mu.Lock() + t.ping.failures[nodeID]++ + failures := t.ping.failures[nodeID] + t.ping.mu.Unlock() + if failures >= pingFailureThreshold { + if node.SetUnreachable(true) { + log.Printf("[ping] %s is unreachable (no ip addresses)", nodeName) + } + } return }