atlasbot: improve missing node inference
This commit is contained in:
parent
0d5e19e11a
commit
b6e8c01e99
@ -754,6 +754,15 @@ def expected_worker_nodes_from_metrics() -> list[str]:
|
||||
return []
|
||||
|
||||
def missing_nodes_answer(cluster_name: str) -> str:
|
||||
expected_workers = expected_worker_nodes_from_metrics()
|
||||
if expected_workers:
|
||||
ready_nodes, not_ready_nodes = worker_nodes_status()
|
||||
current_workers = set(ready_nodes + not_ready_nodes)
|
||||
missing = sorted(set(expected_workers) - current_workers)
|
||||
if not missing:
|
||||
return f"{cluster_name}: no missing worker nodes versus Grafana inventory."
|
||||
return f"{cluster_name} missing worker nodes versus Grafana inventory: {', '.join(missing)}."
|
||||
|
||||
expected = expected_nodes_from_kb()
|
||||
if not expected:
|
||||
return ""
|
||||
@ -1173,7 +1182,7 @@ def sync_loop(token: str, room_id: str):
|
||||
continue
|
||||
send_msg(token, rid, summary)
|
||||
continue
|
||||
if re.search(r"\bnode names?\b|\bnodes? named\b|\bnaming\b", lower_body):
|
||||
if re.search(r"\bnode names?\b|\bnodes?\b.*\bnamed\b|\bnaming\b", lower_body):
|
||||
if any(word in lower_body for word in ("cluster", "atlas", "titan")):
|
||||
names_summary = nodes_names_summary("Atlas")
|
||||
if not names_summary:
|
||||
@ -1181,6 +1190,14 @@ def sync_loop(token: str, room_id: str):
|
||||
continue
|
||||
send_msg(token, rid, names_summary)
|
||||
continue
|
||||
if re.search(r"\bwhich nodes are ready\b|\bnodes ready\b", lower_body):
|
||||
ready_nodes, not_ready_nodes = worker_nodes_status()
|
||||
if ready_nodes:
|
||||
msg = f"Ready worker nodes ({len(ready_nodes)}): {', '.join(ready_nodes)}."
|
||||
if not_ready_nodes:
|
||||
msg += f" Not Ready: {', '.join(not_ready_nodes)}."
|
||||
send_msg(token, rid, msg)
|
||||
continue
|
||||
|
||||
# Only do live cluster introspection in DMs; metrics can be answered when mentioned.
|
||||
allow_tools = is_dm
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user