Fix: only SSH into explicitly configured hosts for ethtool collection

LinkStatsCollector.collect() was SSHing into every host reporting
node_network_* metrics to Prometheus, including unrelated app servers
like postgresql and matrix. Add instance_map membership check so ethtool
collection via Pulse only runs on hosts defined in config.json.

Prometheus metrics (traffic rates, errors) are still collected for all
instances — only the SSH/ethtool step is gated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 18:35:21 -04:00
parent b29b70d88b
commit eb8c0ded5e

View File

@@ -559,9 +559,11 @@ class LinkStatsCollector:
host_ip = instance.split(':')[0] host_ip = instance.split(':')[0]
ifaces = list(iface_metrics.keys()) ifaces = list(iface_metrics.keys())
# SSH ethtool collection via Pulse worker (one connection per host, all ifaces) # SSH ethtool collection via Pulse worker — only for explicitly configured
# hosts (instance_map keys). Hosts like postgresql/matrix may report
# node_exporter metrics to Prometheus but don't need link diagnostics.
ethtool_data: Dict[str, dict] = {} ethtool_data: Dict[str, dict] = {}
if self.pulse.url and ifaces: if self.pulse.url and ifaces and instance in instance_map:
try: try:
ethtool_data = self._ssh_batch(host_ip, ifaces) ethtool_data = self._ssh_batch(host_ip, ifaces)
except Exception as e: except Exception as e: