I had the same issue and was able to fix the problem. I noticed that ambari-server disk space is 100% full and after reclaiming the space and restarting ambari server the postgressql server is back to operational and was able to login into ambari ui
Thanks,Venkat