Monitor Postgres database status on Docker

Started by Daulat Ramover 6 years ago5 messagesgeneral
Jump to latest
#1Daulat Ram
Daulat.Ram@exponential.com

Hi team,

We want to check the postgres database status on docker container just like we monitor Postgres (up / down) via /etc/init.d/postgresql status

But I am not sure how we can do that with docker.

Thanks,
Daulat

#2Fan Liu
fan.liu@ericsson.com
In reply to: Daulat Ram (#1)
RE: Monitor Postgres database status on Docker

Hi,

I am not from PostgreSQL team.
Just let you know that when we run PostgreSQL in Kubernetes, we use below command for liveness check.

pg_isready --host localhost -p $PG_PORT -U $PATRONI_SUPERUSER_USERNAME

BRs,
Fan Liu

From: Daulat Ram <Daulat.Ram@exponential.com>
Sent: Tuesday, September 24, 2019 5:18 PM
To: pgsql-general@lists.postgresql.org
Subject: Monitor Postgres database status on Docker

Hi team,

We want to check the postgres database status on docker container just like we monitor Postgres (up / down) via /etc/init.d/postgresql status

But I am not sure how we can do that with docker.

Thanks,
Daulat

#3Daulat Ram
Daulat.Ram@exponential.com
In reply to: Fan Liu (#2)
RE: Monitor Postgres database status on Docker

Thanks but how we can use it for docker container.

Regards,
Daulat

From: Fan Liu <fan.liu@ericsson.com>
Sent: Tuesday, September 24, 2019 3:02 PM
To: Daulat Ram <Daulat.Ram@exponential.com>; pgsql-general@lists.postgresql.org
Subject: RE: Monitor Postgres database status on Docker

Hi,

I am not from PostgreSQL team.
Just let you know that when we run PostgreSQL in Kubernetes, we use below command for liveness check.

pg_isready --host localhost -p $PG_PORT -U $PATRONI_SUPERUSER_USERNAME

BRs,
Fan Liu

From: Daulat Ram <Daulat.Ram@exponential.com<mailto:Daulat.Ram@exponential.com>>
Sent: Tuesday, September 24, 2019 5:18 PM
To: pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Subject: Monitor Postgres database status on Docker

Hi team,

We want to check the postgres database status on docker container just like we monitor Postgres (up / down) via /etc/init.d/postgresql status

But I am not sure how we can do that with docker.

Thanks,
Daulat

#4Daulat Ram
Daulat.Ram@exponential.com
In reply to: Daulat Ram (#3)
RE: Monitor Postgres database status on Docker

Hi Fan Liu,

I am able to make the connection to the Postgres database created in docker container via psql from postgres10 client but not able to connect through pg_isready.

psql -c 'select count (*) from pg_stat_activity' -h localhost -p 5432 -U postgres -W
Password for user postgres:
count
-------
7

Give me suggestions.
Thanks,

From: Daulat Ram
Sent: Tuesday, September 24, 2019 3:35 PM
To: Fan Liu <fan.liu@ericsson.com>; pgsql-general@lists.postgresql.org
Subject: RE: Monitor Postgres database status on Docker

Thanks but how we can use it for docker container.

Regards,
Daulat

From: Fan Liu <fan.liu@ericsson.com<mailto:fan.liu@ericsson.com>>
Sent: Tuesday, September 24, 2019 3:02 PM
To: Daulat Ram <Daulat.Ram@exponential.com<mailto:Daulat.Ram@exponential.com>>; pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Subject: RE: Monitor Postgres database status on Docker

Hi,

I am not from PostgreSQL team.
Just let you know that when we run PostgreSQL in Kubernetes, we use below command for liveness check.

pg_isready --host localhost -p $PG_PORT -U $PATRONI_SUPERUSER_USERNAME

BRs,
Fan Liu

From: Daulat Ram <Daulat.Ram@exponential.com<mailto:Daulat.Ram@exponential.com>>
Sent: Tuesday, September 24, 2019 5:18 PM
To: pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Subject: Monitor Postgres database status on Docker

Hi team,

We want to check the postgres database status on docker container just like we monitor Postgres (up / down) via /etc/init.d/postgresql status

But I am not sure how we can do that with docker.

Thanks,
Daulat

#5Olivier Gautherot
ogautherot@gautherot.net
In reply to: Daulat Ram (#3)
Re: Monitor Postgres database status on Docker

Hi Daulat,

El mar., 24 de septiembre de 2019 07:05, Daulat Ram <
Daulat.Ram@exponential.com> escribió:

Thanks but how we can use it for docker container.

You have basically 2 ways:

1) Publish the port 5432 on the container and access it from the host, or

2) Use "docker exec" to run the commands natively inside the container.

Show quoted text

Regards,

Daulat

*From:* Fan Liu <fan.liu@ericsson.com>
*Sent:* Tuesday, September 24, 2019 3:02 PM
*To:* Daulat Ram <Daulat.Ram@exponential.com>;
pgsql-general@lists.postgresql.org
*Subject:* RE: Monitor Postgres database status on Docker

Hi,

I am not from PostgreSQL team.

Just let you know that when we run PostgreSQL in Kubernetes, we use below
command for liveness check.

pg_isready --host localhost -p $PG_PORT -U $PATRONI_SUPERUSER_USERNAME

BRs,

Fan Liu

*From:* Daulat Ram <Daulat.Ram@exponential.com>
*Sent:* Tuesday, September 24, 2019 5:18 PM
*To:* pgsql-general@lists.postgresql.org
*Subject:* Monitor Postgres database status on Docker

Hi team,

We want to check the postgres database status on docker container just
like we monitor Postgres (up / down) via /etc/init.d/postgresql status

But I am not sure how we can do that with docker.

Thanks,

Daulat