Auto commit from /home/doc/genesis-tools
This commit is contained in:
parent
94b425146a
commit
4e4f7d797a
@ -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("<html><head><title>Genesis Radio Healthcheck</title><meta http-equiv='refresh' content='60'></head><body>")
|
||||
f.write(f"<h1>Genesis Radio System Health</h1>")
|
||||
f.write(f"<p>Last Checked: {now}</p>")
|
||||
f.write("<table border='1' cellpadding='5' style='border-collapse: collapse;'>
|
||||
<tr><th>System</th><th>Status</th></tr>")
|
||||
f.write("<table border='1' cellpadding='5' style='border-collapse: collapse;'><tr><th>System</th><th>Status</th></tr>")
|
||||
for node, status in node_status.items():
|
||||
color = 'green' if 'Healthy' in status else ('orange' if 'Warning' in status else 'red')
|
||||
f.write(f"<tr><td>{node}</td><td style='color:{color};'>{status}</td></tr>")
|
||||
|
Loading…
x
Reference in New Issue
Block a user