File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -361,9 +361,26 @@ def is_healthy(ssh) -> bool:
361
361
result = run_ssh_command (ssh , command )
362
362
if not result ['succeeded' ]:
363
363
logger .warning (f"{ service } not ready" )
364
+ logger .error (f"{ service } command failed with rc={ cmd .rc } " )
365
+ logger .error (f"{ service } stdout: { cmd .stdout } " )
366
+ logger .error (f"{ service } stderr: { cmd .stderr } " )
367
+
368
+ # For PostgreSQL, also check the logs and systemd status
369
+ if service == "postgres" :
370
+ logger .error ("PostgreSQL logs:" )
371
+ host .run ("sudo cat /var/log/postgresql/postgresql-*.log" )
372
+ logger .error ("PostgreSQL systemd status:" )
373
+ host .run ("sudo systemctl status postgresql" )
374
+ logger .error ("PostgreSQL journal logs:" )
375
+ host .run ("sudo journalctl -u postgresql --no-pager" )
376
+
364
377
return False
365
- except Exception :
366
- logger .warning (f"Connection failed during { service } check" )
378
+ except Exception as e :
379
+ logger .warning (
380
+ f"Connection failed during { service } check, attempting reconnect..."
381
+ )
382
+ logger .error (f"Error details: { str (e )} " )
383
+ host = get_ssh_connection (instance_ip , ssh_identity_file )
367
384
return False
368
385
369
386
return True
You can’t perform that action at this time.
0 commit comments