sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

Can't get sql-exporter to try to connect to db at all

Open caseyandgina opened this issue 6 months ago • 0 comments

I'm trying a very simple config:

global:
  scrape_timeout: 5s
  max_connections: 1
  max_idle_connections: 1

target:
  data_source_name: 'postgres://app_sql_exporter:testpw@localhost:5432/postgres'
  collectors: [simple_test]

collectors:
  - collector_name: simple_test
    metrics:
      - metric_name: simple_value
        type: gauge
        help: Simple test value.
        values:
          - simple_value
        query_ref: simple_query
    queries:
      - query_name: simple_query
        query: select 1 as simple_value

sql-exporter only produces a single line of output, and stays running:

{"build_context":"(go=go1.22.1, platform=linux/amd64, user=, date=, tags=unknown)","caller":"main.go:56","msg":"Starting sql_exporter","ts":"2024-07-26T17:30:33.315441745Z","version_info":"(version=, branch=, revision=unknown)"}
{"caller":"main.go:79","level":"info","listenAddress":":9237","msg":"Listening","ts":"2024-07-26T17:30:33.315676078Z"}

However, it never even tries to connect to the db - there's no connection attempts in the postgres log. Looking at the /metrics endpoint, there's no simple_value metric.

caseyandgina avatar Jul 26 '24 17:07 caseyandgina