canonical / postgresql-operator

A Charmed Operator for running PostgreSQL on machines
https://charmhub.io/postgresql
Apache License 2.0
7 stars 17 forks source link

Monitoring user #499

Open amandahla opened 2 weeks ago

amandahla commented 2 weeks ago

Steps to reproduce

There were no PostgreSQL metrics so I saw these errors in one of the units:

Jun 17 20:05:32 juju-007f82-prod-chat-synapse-db-42 charmed-postgresql.prometheus-postgres-exporter[1392284]: ts=2024-06-17T20:05:32.276Z caller=collector.go:194 level=error msg="collector failed" name=database duration_seconds=0.006477263 err="pq: password authentication failed for user \"monitoring\""

Expected behavior

Grafana dashboard with all metrics.

Actual behavior

Only OS metrics.

Versions

Operating system:

Juju CLI: 3.5.1

Juju agent: 3.1.8

Charm revision: 14/edge 405

LXD:

Log output

Juju debug log:

Additional context

I was able to fix it by setting the monitoring user password again. (Canonical-only) I wrote a how to: https://discourse.canonical.com/t/how-to-fix-postgresql-charm-not-sending-metrics/3801

Maybe it could be considered adding an action to do this.

github-actions[bot] commented 2 weeks ago

https://warthogs.atlassian.net/browse/DPE-4687

dragomirp commented 2 weeks ago

Hi, @amandahla, the set-password and get-password actions should work with the monitoring user as well.

amandahla commented 2 weeks ago

Cool, I thought would be only for the operator user, thanks! I think this issue can be closed then unless you prefer to keep it open for investigating why the monitoring user has a different password at some point.

taurus-forever commented 2 weeks ago

Hi @amandahla , thank you for the bugreport! Regarding set-password you can check https://charmhub.io/postgresql/docs/e-users

I never saw such an issue. I am not sure, how can we fix something here without steps to reproduce. Is it a fresh setup or a long running system? Did metrics gone, or never existed?

From the discourse post:

  content:
    monitoring-password: password
    operator-password: aaa

It looks like the monitoring password was not set (in Juju secrets), do you see some ERRORS in the debug log for those units?

Tnx!