URL to ping Postgres DB to check uptime

You can use pg_isready to check the connection status of a PostgreSQL server

pg_isready --dbname=dbname --host=hostname --port=port --username=username

From the documentation:

pg_isready returns 0 to the shell if the server is accepting connections normally, 1 if the server is rejecting connections (for example during startup), 2 if there was no response to the connection attempt, and 3 if no attempt was made (for example due to invalid parameters).


No, it does not speak HTTP. You'd have to talk to the database using its driver software or make a small web service that does nothing but ping the database on demand.

Tags:

Postgresql