Compare commits

...

2 Commits

Author SHA1 Message Date
48c379dc88 comms: roll atlasbot config 2026-01-28 01:07:26 -03:00
6001876409 atlasbot: add per-hardware extremes 2026-01-28 01:07:13 -03:00
2 changed files with 28 additions and 1 deletions

View File

@ -16,7 +16,7 @@ spec:
labels:
app: atlasbot
annotations:
checksum/atlasbot-configmap: manual-atlasbot-86
checksum/atlasbot-configmap: manual-atlasbot-87
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "comms"
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"

View File

@ -1145,6 +1145,33 @@ def facts_context(
rate=metric in ("net", "io"),
)
lines.append(f"- lowest_{metric}: {node} ({value_fmt})")
for metric in ("cpu", "ram"):
hottest_parts: list[str] = []
lowest_parts: list[str] = []
for hw, nodes_list in sorted(by_hardware.items()):
entries = []
for entry in usage_table:
node = entry.get("node")
if node in nodes_list and entry.get(metric) is not None:
try:
value = float(entry.get(metric))
except (TypeError, ValueError):
continue
entries.append((node, value))
if not entries:
continue
max_node, max_val = max(entries, key=lambda item: item[1])
min_node, min_val = min(entries, key=lambda item: item[1])
hottest_parts.append(
f"{hw}={max_node} ({_format_metric_value(str(max_val), percent=True)})"
)
lowest_parts.append(
f"{hw}={min_node} ({_format_metric_value(str(min_val), percent=True)})"
)
if hottest_parts:
lines.append(f"- hottest_{metric}_by_hardware: {', '.join(hottest_parts)}")
if lowest_parts:
lines.append(f"- lowest_{metric}_by_hardware: {', '.join(lowest_parts)}")
if nodes_in_query:
lines.append("- node_details:")