@@ -338,6 +338,10 @@ def is_healthy(host, instance_ip, ssh_identity_file) -> bool:
338
338
logger .error (f"systemd status: { systemd_status .stdout } " )
339
339
logger .error (f"systemd error: { systemd_status .stderr } " )
340
340
341
+ # Get detailed systemd status
342
+ logger .error ("Detailed systemd status:" )
343
+ host .run ("sudo systemctl status postgresql -l --no-pager" )
344
+
341
345
# Check init script logs
342
346
logger .error ("Init script logs:" )
343
347
host .run ("sudo journalctl -u cloud-init --no-pager" )
@@ -350,6 +354,44 @@ def is_healthy(host, instance_ip, ssh_identity_file) -> bool:
350
354
logger .error ("Init script status:" )
351
355
host .run ("ls -la /tmp/init.sh" )
352
356
host .run ("cat /tmp/init.sh" )
357
+
358
+ # Check PostgreSQL configuration
359
+ logger .error ("PostgreSQL configuration:" )
360
+ host .run ("sudo cat /etc/postgresql/*/main/postgresql.conf" )
361
+ host .run ("sudo cat /etc/postgresql/*/main/pg_hba.conf" )
362
+
363
+ # Check PostgreSQL data directory permissions
364
+ logger .error ("PostgreSQL data directory permissions:" )
365
+ host .run ("sudo ls -la /var/lib/postgresql/*/main/" )
366
+
367
+ # Check PostgreSQL startup logs
368
+ logger .error ("PostgreSQL startup logs:" )
369
+ host .run ("sudo cat /var/log/postgresql/postgresql-*.log" )
370
+
371
+ # Check systemd journal for PostgreSQL
372
+ logger .error ("Systemd journal for PostgreSQL:" )
373
+ host .run ("sudo journalctl -u postgresql -n 100 --no-pager" )
374
+
375
+ # Check for any PostgreSQL-related errors in system logs
376
+ logger .error ("System logs with PostgreSQL errors:" )
377
+ host .run ("sudo journalctl | grep -i postgres | tail -n 100" )
378
+
379
+ # Check for any disk space issues
380
+ logger .error ("Disk space information:" )
381
+ host .run ("df -h" )
382
+ host .run ("sudo du -sh /var/lib/postgresql/*" )
383
+
384
+ # Check for any memory issues
385
+ logger .error ("Memory information:" )
386
+ host .run ("free -h" )
387
+
388
+ # Check for any process conflicts
389
+ logger .error ("Running processes:" )
390
+ host .run ("ps aux | grep postgres" )
391
+
392
+ # Check for any port conflicts
393
+ logger .error ("Port usage:" )
394
+ host .run ("sudo netstat -tulpn | grep 5432" )
353
395
354
396
if socket_check .failed :
355
397
logger .error ("PostgreSQL socket directory check failed" )
0 commit comments