Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

How can read metrics data from timescaledb(pg_prometheus) and pass it to prometheus via prometheus-postgresql-adapter #81

Open
keshav1git opened this issue Jul 9, 2019 · 4 comments
Assignees
Labels

Comments

@keshav1git
Copy link

keshav1git commented Jul 9, 2019

+--------------------+                  +----------------------+                    +------------------+
|                    |                  |      prometheus      |                    |     pg_prometheus|
|      prometheus    |   <-----------+  |      postgres        |  <-------------+   |                  |
|                    |                  |      adapter         |                    |                  |
|                    |                  +----------------------+                    +------------------+
+--------------------+

  • how do i read data stored in pg_prometheus ( say there is a sales column in some table and want to monitor when sales go more than 50 and then raise alert)
    do adapter support reading of data from pg_prometheus and things like mentioned above is doable?

reference : link

@spolcyn
Copy link
Contributor

spolcyn commented Jul 25, 2019

You can either make queries in Prometheus using PromQL (the adapter handles pulling extra data from pg_prometheus to Prometheus, if necessary), or you can make queries in SQL directly on pg_prometheus using a tool like psql. Does that help?

@ctwyw
Copy link

ctwyw commented Sep 4, 2019

@spolcyn It only works on write . But when do some PromQL, I can`t find any read query in prometheus_postgresql_adapter. Is there a mistake in setting it? Both of them were in the docker

remote_write:
    - url: "http://prometheus_postgresql_adapter:9201/write"
remote_read:
    - url: "http://prometheus_postgresql_adapter:9201/read"

@spolcyn
Copy link
Contributor

spolcyn commented Sep 6, 2019

To confirm, you see data in pg_prometheus that you can query locally using SQL, but when you use the Prometheus web interface and PromQL, no results come up?

@bboule bboule self-assigned this Sep 6, 2019
@bboule bboule added the question label Sep 6, 2019
@bboule
Copy link

bboule commented Sep 6, 2019

So I think I can help here... You can query your metrics in the TimescaleDB instance using standard SQL and connecting to PostgreSQL host where you have both the pg_prometheus extension running and timescaledb the data is forwarded to the timescale instance through the adapter, making the data available in the PostgreSQL database, this would be your long term storage. If you wanted to run a PromQL query you would run that against the Prometheus server (by default this server will retain 15 days of data). Let us know if that helps?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants