Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkpoints_timed not found when monitoring Postgres 17beta3 #1060

Open
HansK-p opened this issue Aug 18, 2024 · 13 comments · May be fixed by #1072
Open

checkpoints_timed not found when monitoring Postgres 17beta3 #1060

HansK-p opened this issue Aug 18, 2024 · 13 comments · May be fixed by #1072

Comments

@HansK-p
Copy link

HansK-p commented Aug 18, 2024

What did you do? Upgraded from Postgresql 16 to Postgresql 17beta3

What did you expect to see? Monitoring working as before.

What did you see instead? Under which circumstances?
The error message below is logged by postgres_exporter:

caller=collector.go:202 level=error msg="collector failed" name=stat_bgwriter duration_seconds=0.018634044 err="pq: column \"checkpoints_timed\" does not exist"

This must be as checkpoint related columns in PG 17 have been moved from pg_stat_bgwriter to pg_stat_checkpointer according to https://www.dbi-services.com/blog/postgresql-17-new-catalog-view-pg_stat_checkpointer/.

Environment Running in Kubernetes, any environment.

  • System information:
image: postgres:17beta3
prometheuscommunity/postgres-exporter:v0.15.0
  • postgres_exporter version: v0.15.0

  • postgres_exporter flags: none

  • PostgreSQL version: postgres 17beta3

  • Logs:

caller=collector.go:202 level=error msg="collector failed" name=stat_bgwriter duration_seconds=0.018634044 err="pq: column \"checkpoints_timed\" does not exist"
@n-rodriguez
Copy link
Contributor

n-rodriguez commented Sep 28, 2024

Same here :

PostgreSQL version

postgresql-17               17.0-1.pgdg120+1

postgres_exporter version :

root@32132694b4b9:/# postgres_exporter --version
postgres_exporter, version 0.15.0 (branch: HEAD, revision: 68c176b8833b7580bf847cecf60f8e0ad5923f9a)
  build user:       root@7c5a76bc737a
  build date:       20231027-14:38:04
  go version:       go1.21.3
  platform:         linux/arm64
  tags:             unknown
postgres-exporter-1   | {"caller":"collector.go:202","duration_seconds":0.01493675,"err":"pq: column \"checkpoints_timed\" does not exist","level":"error","msg":"collector failed","name":"stat_bgwriter","ts":"2024-09-28T16:02:37.125Z"}
postgres-1            | 2024-09-28 16:02:37 UTC [158-1] concerto@concerto ERROR:  column "checkpoints_timed" does not exist at character 10
postgres-1            | 2024-09-28 16:02:37 UTC [158-2] concerto@concerto STATEMENT:  SELECT
postgres-1            |       checkpoints_timed
postgres-1            |       ,checkpoints_req
postgres-1            |       ,checkpoint_write_time
postgres-1            |       ,checkpoint_sync_time
postgres-1            |       ,buffers_checkpoint
postgres-1            |       ,buffers_clean
postgres-1            |       ,maxwritten_clean
postgres-1            |       ,buffers_backend
postgres-1            |       ,buffers_backend_fsync
postgres-1            |       ,buffers_alloc
postgres-1            |       ,stats_reset
postgres-1            |     FROM pg_stat_bgwriter;

@vincejv
Copy link

vincejv commented Oct 8, 2024

is there a way to silence these logs while #1072 is being reviewed?

@hiteshnayak305
Copy link

+1

n-rodriguez added a commit to n-rodriguez/postgres_exporter that referenced this issue Oct 17, 2024
@High5Apps
Copy link

High5Apps commented Oct 17, 2024

@vincejv I was able to silence the error logs by running the exporter with the --no-collector.stat_bgwriter flag.

For more info see the Flags section of the README

High5Apps added a commit to High5Apps/organize-backend that referenced this issue Oct 17, 2024
- Fix checkpoints_timed not found error by using the `--no-collector.stat_bgwriter` flag in the docker compose command
  - This flag can be removed once the issue below is fixed, and a new docker image is released
  - prometheus-community/postgres_exporter#1060
- https://github.com/prometheus-community/postgres_exporter
- https://www.rockdata.net/external/postgres_exporter-metrics/
- https://stackoverflow.com/a/59366582
- https://hub.docker.com/r/prometheuscommunity/postgres-exporter
@vincejv
Copy link

vincejv commented Oct 19, 2024

@High5Apps thanks a lot, saved my day, also based from the linked commit
add this to docker compose command: '--no-collector.stat_bgwriter'

n-rodriguez added a commit to n-rodriguez/postgres_exporter that referenced this issue Oct 26, 2024
n-rodriguez added a commit to n-rodriguez/postgres_exporter that referenced this issue Oct 28, 2024
n-rodriguez added a commit to n-rodriguez/postgres_exporter that referenced this issue Nov 13, 2024
@garry-t
Copy link

garry-t commented Nov 14, 2024

any movements here? :)

@Enterprize-1701
Copy link

Enterprize-1701 commented Dec 3, 2024

Same thing
2024-12-03 17:37:56.053 UTC [1599924] postgres_exporter@postgres ERROR: column "checkpoints_timed" does not exist at character 10 2024-12-03 17:37:56.053 UTC [1599924] postgres_exporter@postgres STATEMENT: SELECT checkpoints_timed ,checkpoints_req ,checkpoint_write_time ,checkpoint_sync_time ,buffers_checkpoint ,buffers_clean ,maxwritten_clean ,buffers_backend ,buffers_backend_fsync ,buffers_alloc ,stats_reset FROM pg_stat_bgwriter;

Using in ansible role postgres_exporter for now

postgres_exporter_disabled_collectors:
  - stat_bgwriter

@agjs
Copy link

agjs commented Dec 15, 2024

--no-collector.stat_bgwriter

Did it for me as well.

@Nikolay-Ch
Copy link

Nikolay-Ch commented Dec 16, 2024

--no-collector.stat_bgwriter

Did it for me as well.

This is a workaround, not a solution...

@Enterprize-1701
Copy link

Enterprize-1701 commented Dec 16, 2024

Solution for now is to use SQL_exporter and make your own queries:

collector_name: pg_writer
metrics:
  - metric_name: pg_stat_bgwriter_buffers_clean_total
    type: counter
    help: "Total buffers cleaned by the background writer"
    values: [buffers_clean]
    query_ref: pg_stat_bgwriter

  - metric_name: pg_stat_bgwriter_maxwritten_clean
    type: gauge
    help: "Number of times the background writer stopped due to max written clean limit"
    values: [maxwritten_clean]
    query_ref: pg_stat_bgwriter

  - metric_name: pg_stat_bgwriter_buffers_alloc_total
    type: counter
    help: "Total buffers allocated"
    values: [buffers_alloc]
    query_ref: pg_stat_bgwriter

queries:
  - query_name: pg_stat_bgwriter
    query: |
      SELECT
        buffers_clean,
        maxwritten_clean,
        buffers_alloc
      FROM
        pg_stat_bgwriter;

@n-rodriguez
Copy link
Contributor

Solution for now is to use SQL_exporter and make your own queries:

A better solution #1072 😄

@Enterprize-1701
Copy link

Solution for now is to use SQL_exporter and make your own queries:

A better solution #1072 😄

It was't merge.

@n-rodriguez
Copy link
Contributor

It was't merge.

I know, I'm still waiting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants