pgwatch2 icon indicating copy to clipboard operation
pgwatch2 copied to clipboard

PGWatch2 not returning version

Open davidnateberg opened this issue 3 years ago • 9 comments

Hello, I am deploying pgwatch with helm, trying to use two databases, im not sure if thats related to the problem or not. One database is the one that I want metrics from, the other is the one with the pgwatch2 db and the pgwatch2_metrics db. Everything seemed to be going fine with the deployment, except I have no data in the metrics db. The databases initialize successfully, and theres no connection issues with them. The error I'm seeing now is

2022/09/08 12:36:07 WARN main: Could not find PG version info for DB , skipping shutdown check of metric worker process for backends

this is happening for all dbs. I tracked down the query its running in the daemon code, and I see its this query

select (regexp_matches(
                        regexp_replace(current_setting('server_version'), '(beta|devel).*', '', 'g'),
                        E'\\\\d+\\\\.?\\\\d+?')
                        )[1]::text as ver, not pg_is_in_recovery() as is_primary

https://github.com/cybertec-postgresql/pgwatch2/blob/b27310ca3cb41828a2fca776d0485ad594cb4633/pgwatch2/metrics/test_all_metrics.py

when I run that, it returns nothing. Were running postgres version 12 in RDS. Not sure how to resolve this one. Thanks!

davidnateberg avatar Sep 08 '22 12:09 davidnateberg

I dont want to sound naggy, but I was hoping to deploy this semi soon to help us monitor a production issue were having @pashagolub. This is also just a warning so perhaps its a red herring?

davidnateberg avatar Sep 08 '22 13:09 davidnateberg

Same here, PG 14.4. Docker run this project and add PG via localhost:8080

archongum avatar Sep 19 '22 06:09 archongum

Would you please show what is the result of

SELECT current_setting('server_version')

pashagolub avatar Sep 19 '22 06:09 pashagolub

Would you please show what the result of

SELECT current_setting('server_version')

Hold on... Let me deploy over again

archongum avatar Sep 19 '22 06:09 archongum

Would you please show what is the result of

SELECT current_setting('server_version')

14.4 (Debian 14.4-1.pgdg110+1)

Still not working image

archongum avatar Sep 19 '22 07:09 archongum

So just to be sure. Are you saying the metric is not working in the deployment or exactly test_all_metrics.py test script?

pashagolub avatar Sep 19 '22 07:09 pashagolub

Would you please show what is the result of

SELECT current_setting('server_version')

14.4 (Debian 14.4-1.pgdg110+1)

Still not working image

It works after docker restart container image

archongum avatar Sep 19 '22 08:09 archongum

oh gosh. That's weird!

pashagolub avatar Sep 19 '22 08:09 pashagolub

So, for me, the metrics not being written to the metrics DB was not related to this warning. Instead I realized that with the helm deployment, if you remove the databases key from the values.yaml file, in this section

databases:
- host: pgwatch2-postgresql
  grafana_preset_metrics: remotedba
  port: 5432
  user: pgwatch2
  password: 'pgwatch2'
  dbs:
    - postgres
    - foo
    - bar

because the config map that is responsible for creating the rows in the monitored_db's table with the connection information uses that value. So without it connections dont work. But it's hard to figure out why because, the connection will still pass the connection tests if you have the password set elsewhere.

davidnateberg avatar Sep 19 '22 15:09 davidnateberg

📅 This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. ♻️ If you think there is new information allowing us to address the issue, please reopen it and provide us with updated details. 🤝 Thank you for your contributions.

github-actions[bot] avatar Nov 19 '22 00:11 github-actions[bot]