apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.12k stars 175 forks source link

[BUG]PostgreSQL exporter scrape error and some panels of Grafana return no data #2078

Closed ahjing99 closed 1 year ago

ahjing99 commented 1 year ago

➜ ~ kbcli version Kubernetes: v1.24.9-gke.3200 KubeBlocks: 0.4.0-beta.19 kbcli: 0.4.0-beta.19

  1. ➜ ~ kbcli cluster create pgcluster --termination-policy=Halt --monitor=true --enable-all-logs=false --cluster-definition=postgresql --cluster-version=postgresql-14.7.0 --set cpu=100m,memory=500Mi,replicas=1,storage=1Gi Cluster pgcluster created

2.add an alert receiver

  1. receive an alert
    AlertName: PostgreSQLExporterError
    Status: FIRING(1)
    Severity: WARNING
    Namespace: default
    Cluster: pgcluster
    Summary: PostgreSQL exporter scrape error
    Descriptions:
    - PostgreSQL exporter has 1.00 scrape errors. A query may be buggy in query.yaml. (instance: pgcluster-pg-replication-0) [01:22:48]
  2. create table, do some query
    1. some panels in grafana dashboard return no data image
ahjing99 commented 1 year ago

This is because pg_stat_statements was not created successfully on my cluster

ts=2023-03-17T01:24:29.392Z caller=namespace.go:236 level=info err="Error running query on database \"[127.0.0.1:5432](http://127.0.0.1:5432/)\": pg_stat_statements pq: relation \"pg_stat_statements\" does not exist"
ts=2023-03-17T01:24:29.472Z caller=postgres_exporter.go:714 level=error err="queryNamespaceMappings returned 1 errors"

cat postgresql-2023-03-17.csv

2023-03-17 01:22:40.064 GMT,,,164,,6413c0dd.a4,8,,2023-03-17 01:22:37 GMT,,0,LOG,00000,"background worker ""logical replication launcher"" (P
ID 175) exited with exit code 1",,,,,,,,,"","postmaster",,0
2023-03-17 01:22:40.065 GMT,"postgres","postgres",192,"[local]",6413c0df.c0,2,"CREATE EXTENSION",2023-03-17 01:22:39 GMT,3/9,735,FATAL,57P01,
"terminating connection due to administrator command",,,,,,"CREATE EXTENSION IF NOT EXISTS pg_stat_statements;",,,"psql","client backend",,-8
063160503150200351
2023-03-17 01:22:40.067 GMT,,,170,,6413c0de.aa,5,,2023-03-17 01:22:38 GMT,,0,LOG,00000,"shutting down",,,,,,,,,"","checkpointer",,0
2023-03-17 01:22:40.069 GMT,,,170,,6413c0de.aa,6,,2023-03-17 01:22:38 GMT,,0,LOG,00000,"checkpoint starting: shutdown immediate",,,,,,,,,"","
checkpointer",,0