-
Notifications
You must be signed in to change notification settings - Fork 803
Closed
Labels
Description
Hi, I'm using exporter in Docker image, In docker compose, see below.
I get errors and the image won't deploy. Any idea what I did wrong?
services:
postgresql-exporter:
image: wrouesnel/postgres_exporter:latest
ports:
- 9187:9187
networks:
- public
volumes:
- postgresql_exporter_config:/etc/postgres_exporter
environment:
- DATA_SOURCE_NAME=postgresql://pgieduct:********@id-devops-7:12111/educonnect?sslmode=disable&search_path=outils
- PG_EXPORTER_EXTEND_QUERY_PATH=/etc/postgres_exporter/queries.yml
command:
- '--auto-discover-databases'My queries.yml file looks like this
pg_replication:
query: "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp())) as lag"
metrics:
- lag:
usage: "GAUGE"
description: "Replication lag behind master in seconds"
pg_postmaster:
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
metrics:
- start_time_seconds:
usage: "GAUGE"
description: "Time at which postmaster started"
pg_stat_user_tables:
query: "SELECT schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables"
metrics:
- schemaname:
usage: "LABEL"
description: "Name of the schema that this table is in"
- relname:
usage: "LABEL"
description: "Name of this table"
- seq_scan:
usage: "COUNTER"
description: "Number of sequential scans initiated on this table"
- seq_tup_read:
usage: "COUNTER"
description: "Number of live rows fetched by sequential scans"
- idx_scan:
usage: "COUNTER"
description: "Number of index scans initiated on this table"
- idx_tup_fetch:
usage: "COUNTER"
description: "Number of live rows fetched by index scans"
- n_tup_ins:
usage: "COUNTER"
description: "Number of rows inserted"
- n_tup_upd:
usage: "COUNTER"
description: "Number of rows updated"
- n_tup_del:
usage: "COUNTER"
description: "Number of rows deleted"
- n_tup_hot_upd:
usage: "COUNTER"
description: "Number of rows HOT updated (i.e., with no separate index update required)"
- n_live_tup:
usage: "GAUGE"
description: "Estimated number of live rows"
- n_dead_tup:
usage: "GAUGE"
description: "Estimated number of dead rows"
- n_mod_since_analyze:
usage: "GAUGE"
description: "Estimated number of rows changed since last analyze"
- last_vacuum:
usage: "GAUGE"
description: "Last time at which this table was manually vacuumed (not counting VACUUM FULL)"
- last_autovacuum:
usage: "GAUGE"
description: "Last time at which this table was vacuumed by the autovacuum daemon"
- last_analyze:
usage: "GAUGE"
description: "Last time at which this table was manually analyzed"
- last_autoanalyze:
usage: "GAUGE"
description: "Last time at which this table was analyzed by the autovacuum daemon"
- vacuum_count:
usage: "COUNTER"
description: "Number of times this table has been manually vacuumed (not counting VACUUM FULL)"
- autovacuum_count:
usage: "COUNTER"
description: "Number of times this table has been vacuumed by the autovacuum daemon"
- analyze_count:
usage: "COUNTER"
description: "Number of times this table has been manually analyzed"
- autoanalyze_count:
usage: "COUNTER"
description: "Number of times this table has been analyzed by the autovacuum daemon"
pg_statio_user_tables:
query: "SELECT schemaname, relname, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables"
metrics:
- schemaname:
usage: "LABEL"
description: "Name of the schema that this table is in"
- relname:
usage: "LABEL"
description: "Name of this table"
- heap_blks_read:
usage: "COUNTER"
description: "Number of disk blocks read from this table"
- heap_blks_hit:
usage: "COUNTER"
description: "Number of buffer hits in this table"
- idx_blks_read:
usage: "COUNTER"
description: "Number of disk blocks read from all indexes on this table"
- idx_blks_hit:
usage: "COUNTER"
description: "Number of buffer hits in all indexes on this table"
- toast_blks_read:
usage: "COUNTER"
description: "Number of disk blocks read from this table's TOAST table (if any)"
- toast_blks_hit:
usage: "COUNTER"
description: "Number of buffer hits in this table's TOAST table (if any)"
- tidx_blks_read:
usage: "COUNTER"
description: "Number of disk blocks read from this table's TOAST table indexes (if any)"
- tidx_blks_hit:
usage: "COUNTER"
description: "Number of buffer hits in this table's TOAST table indexes (if any)"
pg_database:
query: " SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
metrics:
- datname:
usage: "LABEL"
description: "Name of the database"
- size:
usage: "GAUGE"
description: "Disk space used by the database"
pg_stat_statements:
query: "SELECT pg_get_userbyid(userid) as user, pg_database.datname, pg_stat_statements.queryid, pg_stat_statements.calls, pg_stat_statements.total_time as time_milliseconds, pg_stat_statements.rows, pg_stat_statements.shared_blks_hit, pg_stat_statements.shared_blks_read, pg_stat_statements.shared_blks_dirtied, pg_stat_statements.shared_blks_written, pg_stat_statements.local_blks_hit, pg_stat_statements.local_blks_read, pg_stat_statements.local_blks_dirtied, pg_stat_statements.local_blks_written, pg_stat_statements.temp_blks_read, pg_stat_statements.temp_blks_written, pg_stat_statements.blk_read_time, pg_stat_statements.blk_write_time FROM outils.pg_stat_statements JOIN pg_database ON pgread_database.oid = pg_stat_statements.dbid"
metrics:
metrics:
- user:
usage: "LABEL"
description: "The user who executed the statement"
- datname:
usage: "LABEL"
description: "The database in which the statement was executed"
- queryid:
usage: "LABEL"
description: "Internal hash code, computed from the statement's parse tree"
- calls:
usage: "COUNTER"
description: "Number of times executed"
- time_milliseconds:
usage: "COUNTER"
description: "Total time spent in the statement, in milliseconds"
- rows:
usage: "COUNTER"
description: "Total number of rows retrieved or affected by the statement"
- shared_blks_hit:
usage: "COUNTER"
description: "Total number of shared block cache hits by the statement"
- shared_blks_read:
usage: "COUNTER"
description: "Total number of shared blocks read by the statement"
- shared_blks_dirtied:
usage: "COUNTER"
description: "Total number of shared blocks dirtied by the statement"
- shared_blks_written:
usage: "COUNTER"
description: "Total number of shared blocks written by the statement"
- local_blks_hit:
usage: "COUNTER"
description: "Total number of local block cache hits by the statement"
- local_blks_read:
usage: "COUNTER"
description: "Total number of local block read by the statement"
- local_blks_dirtied:
usage: "COUNTER"
description: "Total number of local block dirtied by the statement"
- local_blks_written:
usage: "COUNTER"
description: "Total number of local block written by the statement"
- temp_blks_read:
usage: "COUNTER"
description: "Total number of temp block read by the statement"
- temp_blks_written:
usage: "COUNTER"
description: "Total number of temp block written by the statement"
- blk_read_time:
usage: "COUNTER"
description: "Blocks read time"
- blk_write_time:
usage: "COUNTER"
description: "Blocks write time"
Somehow I get this error, only when adding the PG_EXPORTER_EXTEND_QUERY_PATH env var (No error if I remove it).
postgresql-exporter_1 | time="2019-10-09T09:38:19Z" level=info msg="Established new database connection to \"id-devops-7:12111\"." source="postgres_exporter.go:778"
postgresql-exporter_1 | time="2019-10-09T09:38:19Z" level=info msg="Established new database connection to \"id-devops-7:12111\"." source="postgres_exporter.go:778"
postgresql-exporter_1 | time="2019-10-09T09:38:19Z" level=info msg="Semantic Version Changed on \"id-devops-7:12111\": 0.0.0 -> 9.4.9" source="postgres_exporter.go:1238"
postgresql-exporter_1 | panic: interface conversion: interface {} is map[interface {}]interface {}, not []interface {}
postgresql-exporter_1 |
postgresql-exporter_1 | goroutine 17 [running]:
postgresql-exporter_1 | main.addQueries(0xc00029a000, 0x1f1b, 0x211b, 0x9, 0x4, 0x9, 0x0, 0x0, 0x0, 0x0, ...)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:413 +0xfdb
postgresql-exporter_1 | main.(*Exporter).checkMapVersions(0xc0001a8000, 0xc0001aa000, 0xc00022a300, 0xc00022a300, 0x0)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:1263 +0xc6f
postgresql-exporter_1 | main.(*Exporter).scrapeDSN(0xc0001a8000, 0xc0001aa000, 0xc000248000, 0x5d)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:1357 +0x1c0
postgresql-exporter_1 | main.(*Exporter).scrape(0xc0001a8000, 0xc0001aa000)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:1301 +0x133
postgresql-exporter_1 | main.(*Exporter).Collect(0xc0001a8000, 0xc0001aa000)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:1060 +0x3c
postgresql-exporter_1 | main.(*Exporter).Describe(0xc0001a8000, 0xc000128540)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/cmd/postgres_exporter/postgres_exporter.go:1053 +0xb0
postgresql-exporter_1 | github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Register.func1(0x97dc20, 0xc0001a8000, 0xc000128540)
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:242 +0x3b
postgresql-exporter_1 | created by github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Register
postgresql-exporter_1 | /home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:241 +0x14e
grafana-prometheus-exporters-stack_postgresql-exporter_1 exited with code 2