From 4e4f7d797a90da4a2547d2873756e2221ba1f249 Mon Sep 17 00:00:00 2001 From: DocTator Date: Mon, 28 Apr 2025 14:56:27 -0400 Subject: [PATCH] Auto commit from /home/doc/genesis-tools --- miscellaneous/dbcheck1.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/miscellaneous/dbcheck1.py b/miscellaneous/dbcheck1.py index ee49efe..a376290 100644 --- a/miscellaneous/dbcheck1.py +++ b/miscellaneous/dbcheck1.py @@ -23,7 +23,7 @@ NODES = [ {"name": "db2", "host": "cluster.db2.genesishostingtechnologies.com", "ssh_user": "doc", "services": ["postgresql@16-main.service"], "disks": ["/", "/var/lib/postgresql"], "type": "remote", "db": True, "raid": False} ] -# ==== Mastodon DM function with retry ==== +# ==== Mastodon DM with retry ==== def mastodon_dm(message, retries=3): url = f"{MASTODON_INSTANCE}/api/v1/statuses" headers = {"Authorization": f"Bearer {MASTODON_TOKEN}"} @@ -59,7 +59,7 @@ def choose_emoji(line): return "💥" return "⚠️" -# ==== Check rclone health ==== +# ==== Health checks ==== def check_rclone_health(node): try: result = ssh_command(node["host"], node["ssh_user"], "rclone rc vfs/stats") @@ -73,7 +73,6 @@ def check_rclone_health(node): return ("critical", f"[{node['name']}] ERROR: Could not check rclone health: {str(e)}") return None -# ==== Remote log scan ==== def check_remote_logs(host, user, node_name): alerts = [] for log in LOG_FILES: @@ -89,7 +88,7 @@ def check_remote_logs(host, user, node_name): alerts.append(f"[{node_name}] ERROR: Could not read log {log}: {e}") return alerts -# ==== Main Routine ==== +# ==== Main routine ==== def main(): critical_problems = [] warning_problems = [] @@ -178,8 +177,7 @@ def main(): f.write("Genesis Radio Healthcheck") f.write(f"

Genesis Radio System Health

") f.write(f"

Last Checked: {now}

") - f.write(" -") + f.write("
SystemStatus
") for node, status in node_status.items(): color = 'green' if 'Healthy' in status else ('orange' if 'Warning' in status else 'red') f.write(f"")
SystemStatus
{node}{status}