GithubHelp home page GithubHelp logo

prometheus-community / postgres_exporter Goto Github PK

View Code? Open in Web Editor NEW
2.7K 2.7K 714.0 7.33 MB

A PostgreSQL metric exporter for Prometheus

License: Apache License 2.0

Go 92.81% Shell 4.93% Dockerfile 0.22% Makefile 0.27% Jsonnet 1.76%

postgres_exporter's People

Contributors

arnogeurts-sqills avatar cezmunsta avatar dependabot[bot] avatar divergentdave avatar dswarbrick avatar jtilander avatar juris-greitans avatar kavirajk avatar khiemdoan avatar luckz avatar marcwort avatar mattbostock avatar matthias-kloeckner avatar michaelkaye avatar ncabatoff avatar noushi avatar paulfantom avatar prombot avatar pvanderlinden avatar regeda avatar robsonpeixoto avatar roidelapluie avatar sfalkon avatar sheldor14 avatar sticksman avatar superq avatar sysadmind avatar tomhughes avatar wrouesnel avatar yann-soubeyrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postgres_exporter's Issues

custom queries file

Hi,
I am using the following docker command to start the exporter
docker run -e DATA_SOURCE_NAME="postgresql://postgres:postgres@xxxxxx:5432/mydb?sslmode=disable" -p 9187:9187 wrouesnel/postgres_exporter

Its getting started and am able to see the default metrics in the URL.

How can i use custom config file for queries? i tried passing -extend.query-path=/home/prometheus/queries.yaml in the docker run command. But seems to be not working.

Thanks
Ratheesh

Display query in error message

time="2017-02-27T02:15:20Z" level=info msg="Error running query on database:  pg_stat_replication pq: recovery is in progress\n" source="postgres_exporter.go:919"

I'm getting a generic error message about an error when running a query on the database. However, it is difficult for me to track down which query/custom query is causing this issue. It'll be really helpful if the error message could display the query that has been ran.

Thanks in advanced 👍

Amazon RDS pg_settings

On Amazon's RDS there are additional settings that are getting picked up via pg_settings which are eventually causing an error due to the name of the setting:
The problem settings are:

rds.rds_superuser_reserved_connections | 2         |          | Sets the number of connection slots reserved for rds_superusers.    | integer
rds.restrict_logical_slot_creation     | off       |          | Restrict logical slot creation over streaming replication protocol. | bool

These two rows ultimately end up causing a panic:

panic: descriptor Desc{fqName: "pg_settings_rds.rds_superuser_reserved_connections", help: "Sets the number of connection slots reserved for rds_superusers.", constLabels: {}, variableLabels: []} is invalid: "pg_settings_rds.rds_superuser_reserved_connections" is not a valid metric name

I'm happy to make a patch for this, but I'm not sure what the preferred approach would be. A simple fix would be to substitute the . with an _ in the pg_settings.name field. We could also just ignore any rows starting with rds..

labeling metrics ..

Hi ..
hope my question is not too dump.. I am just considering migrating from Telegraph/InfluxDB to Prometheus.
Right now I am running some PostgreSQL cloud where I provision PostgreSQL DBs via Rest. At creation time each DB is tagged with some UUID. For each DB I kick off a telegraph processs. In the telegraph config I set
[global_tags]
dbid = "some UUID"
In this way I tag all metrics with the UUID of the DB.
When user launches a Grafana dashboard the URL that I provide contains the UUID and it is used to display in the dashboard only the metrics belonging to this db instance.

Now I am looking at your postgres_exporter and do not find a way how to inject this kind of info. As I understood Prometheus would support the same bz using labels, but how can I inject such a label on the exporter level.

Thanks for clarification
Heiko

Publish docker image on Docker Hub

I see you have a Dockerfile, but no corresponding image on dockerhub. Would be cool if you could publish an image. Currently I am just publishing an image to a private image repo, but would just use the public one if it existed.

query to custom database.

Hello,
I want to use queries.yaml for request to my custom postgres databases, but i don't understand how. Shold i use database name in DSN like this :
DATA_SOURCE_NAME=postgresql://postgres_exporter:password@localhost:5432/my_custom_db?sslmode=disable
or i can set database in queries.yaml?

Accept empty DATA_SOURCE_NAME

lib/pq supports various environment variables that make it possible to connect to a database with an empty dsn, by specifying the environment variables PGHOST, PGUSER, PGPASSWORD and so on. It would be nice if postgres_exporter, too, supported this.

Right now, one can work around this by using a value of " ", but that feels rather clumsy.

pg_stat_replication* metrics missing

Hi,
this flag - config.expect-replication-stats is in README but its not supported anymore?

Im connecting postgres_exporter as superuser-enabled user to my 3 instances of psql (master-slave-slave, i use template1 as entrypoint db in the datasource), and i see many metrics, but the replication-oriented ones are missing.

Postgres version - 9.5.3 gets detected properly, and debug log level is not throwing any errors.

What am i doing wrong? Thanks!

Lack of connection pooling

The exporter process keeps connecting/disconnecting every time it fetches some metric. This results in new Postgres forking all the time, which can cause serious problems in production environment as it leads to memory fragmentation.

Custom query may cause "integer out of range" errors

Hello,

I've used queries.yaml from the repository itself. However, it seems that our shared buffers are too big and are causing "integer out of range".

postgres_exporter[8248]: time="2017-02-09T10:21:36Z" level=info
msg="Error running query on database:  pg_settings_shared_buffers pq: integer out of range\n"
source="postgres_exporter.go:919"

I'm wondering whether this is bug or feature.

Thank you very much.

Help with permissions

Hello,
I wont create additional user for collect metricks in postgress. Which permissions i should have in postgres for postgres_exporter?

Getting panic: inconsistent label cardinality when starting

I followed the supplied commands to make the project . While connecting to my local Postgres Db,

I am getting :

export DATA_SOURCE_NAME="postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable"

# ./postgres_exporter
INFO[0000] Established new database connection.          source=postgres_exporter.go:951
INFO[0000] Semantic Version Changed: 0.0.0 -> 9.4.1      source=postgres_exporter.go:904
panic: inconsistent label cardinality

goroutine 17 [running]:
postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus.MustNewConstMetric(0xc42021c770, 0x3, 0x0, 0xc42025b120, 0x2, 0x2, 0x0, 0x0)
	/usr/local/go/src/postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus/value.go:172 +0xb3
main.queryNamespaceMapping(0xc420184000, 0xc42014e280, 0x7c9e3f, 0x10, 0xc420129180, 0x2, 0x2, 0xc420139500, 0xc420139b90, 0x0, ...)
	/usr/local/go/src/postgres_exporter-master/postgres_exporter.go:853 +0x1200
main.queryNamespaceMappings(0xc420184000, 0xc42014e280, 0xc4201391a0, 0xc420139b90, 0x0)
	/usr/local/go/src/postgres_exporter-master/postgres_exporter.go:868 +0x321
main.(*Exporter).scrape(0xc420182000, 0xc420184000)
	/usr/local/go/src/postgres_exporter-master/postgres_exporter.go:996 +0x58d
main.(*Exporter).Collect(0xc420182000, 0xc420184000)
	/usr/local/go/src/postgres_exporter-master/postgres_exporter.go:747 +0x39
main.(*Exporter).Describe(0xc420182000, 0xc420144120)
	/usr/local/go/src/postgres_exporter-master/postgres_exporter.go:740 +0xb0
postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus.(*registry).Register.func1(0x97ab20, 0xc420182000, 0xc420144120)
	/usr/local/go/src/postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus/registry.go:218 +0x3b
created by postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus.(*registry).Register
	/usr/local/go/src/postgres_exporter-master/vendor/github.com/prometheus/client_golang/prometheus/registry.go:217 +0xbc

I am unsure about why the panic: inconsistent label cardinality error occurs.

feature request: up metric ?

It would be convenient to have postgres exporter provide 'up' metric.
Just like most other popular exporters do (mysql, redis, etc)

The idea of this metric is that it outputs the value of 1 when there is a connection to postgres and 0 when there is no connection.

Having this metric one could set up an alert on postgres unavailability.
Here is the example from mysql:

# Mysql service not up
ALERT MysqlUp
  IF mysql_up{job = "mysql"} != 1
  FOR 1m
....
...

cannot parse some SHOW variables

I was trying out the latest master and get this:

time="2016-07-27T14:07:50Z" level=error msg="Unexpected error parsing column:  pg max_pred_locks_per_transaction 64" file="postgres_exporter.go" line=471
time="2016-07-27T14:07:50Z" level=error msg="Unexpected error parsing column:  pg max_identifier_length 63" file="postgres_exporter.go" line=471
time="2016-07-27T14:07:50Z" level=error msg="Unexpected error parsing column:  pg max_locks_per_transaction 64" file="postgres_exporter.go" line=471

This is querying postgresql 9.5. It seems that the query:

SHOW max_pred_locks_per_transaction;

returns a "text" type. But eyeballing the code, that should work...

Documentation improvements

Hi;

As a note, your documentation as to how to run as a non-superuser is needlessly complex. In PostgreSQL, views are already security definer and have been for a long time, so no need for the view -> function -> table approach. Just build a view around the table and a security definer function around the function you need to expose. I am likely to submit a PR to this effect in the near future.

Release new version

Hello!

At first, thank you and all contributors for your great job!

Can you release new version and publish new binaries? I need feature about select from yaml file and I am using Ansible role which needs to have URL for latest binary.
I can for, build, release new version and working with my fork. But it's not a true way. :)

Thank you, @wrouesnel.

tar.gz releases

Most exporters are being distributed within a gzipped tarball, distributing this exporter in the same way will ease and make a bit more consistent deployment scripts. Other than that, thanks a lot for the great work with this exporter 👍

-config.expect-replication-stats doesn't actually work

We are attempting to enable replication stats in the most recent version of the exporter, but it says that the config flag is not defined. Below is the output of the command and the command we are running. I've tried it with and without true attached to the config option.

/etc/sv/postgres_exporter/run:

root@db1:~# cat /etc/sv/postgres_exporter/run
#!/bin/sh

export DATA_SOURCE_NAME="<redacted>"
exec chpst -u prometheus /opt/prometheus/postgres_exporter/postgres_exporter -config.expect-replication-stats=true
root@db1:~# /etc/sv/postgres_exporter/run
flag provided but not defined: -config.expect-replication-stats
Usage of /opt/prometheus/postgres_exporter/postgres_exporter:
  -dumpmaps
        Do not run, simply dump the maps.
  -extend.query-path string
        Path to custom queries to run.
  -log.format value
        If set use a syslog logger or JSON logging. Example: logger:syslog?appname=bob&local=7 or logger:stdout?json=true. Defaults to stderr.
  -log.level value
        Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal].
  -web.listen-address string
        Address to listen on for web interface and telemetry. (default ":9187")
  -web.telemetry-path string
        Path under which to expose metrics. (default "/metrics")

Feature request: gloabl labels

Hi! Thanks for opensoursing!
I have a feature request for gloabal labels in custom queries file.
Use case: for example, I have huge postgresql cluster with multiple slaves and auto-failover. And I know how I can figure out who is the master for now, but I can do it only with separate metric, but as a result of this feature I want to see 'role=master' label for every metric exporter exports. This global labels should be computable in runtime, not just config flags.

If you haven't time for this - pls, tell about that, I'll try to contribute.

Thanks!

Londiste replication query

I tried to add query to view londiste replication lag with these:

pg_londiste_replication:
  query: "SELECT consumer_name, GREATEST(0, EXTRACT(EPOCH FROM lag)) as londiste_lag, pending_events from pgq.get_consumer_info() where consumer_name !~ 'watermark$'"
  metrics:
    - londiste_lag:
        usage: "GAUGE"
        description: "Londiste lag"
    - pending_events:
        usage: "GAUGE"
description: "Londiste pending events"

but ended up error:

INFO[0000] Unparseable column type - discarding:  pg_londiste_replication consumer_name <nil>
  source=postgres_exporter.go:924

Tried to change consumer_name to consumer_name::text but no luck with the same error.
Did I miss anything?

Unexpected error parsing column

I'm getting the error below when using this exporter for pg_stat_bgwriter, pg_stat_database, and pg_stat_database_conflicts table views. This doesn't seem to be an access/permissions issue as I can run manual queries without a problem. Could this be a data type issue? The columns throwing an error below are integer, bigint and timestamp with time zone types.

I'm running PostgreSQL 9.4.5 on RDS if that helps.

time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter checkpoints_timed <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter checkpoints_req <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter buffers_checkpoint <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter buffers_clean <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter maxwritten_clean <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter buffers_backend <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter buffers_backend_fsync <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter buffers_alloc <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_bgwriter stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database numbackends <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_commit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_rollback <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_read <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_hit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_returned <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_fetched <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_inserted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_updated <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_deleted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database conflicts <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_files <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_bytes <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database deadlocks <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database numbackends <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_commit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_rollback <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_read <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_hit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_returned <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_fetched <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_inserted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_updated <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_deleted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database conflicts <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_files <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_bytes <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database deadlocks <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database numbackends <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_commit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_rollback <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_read <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_hit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_returned <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_fetched <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_inserted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_updated <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_deleted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database conflicts <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_files <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_bytes <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database deadlocks <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database numbackends <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_commit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_rollback <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_read <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_hit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_returned <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_fetched <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_inserted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_updated <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_deleted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database conflicts <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_files <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_bytes <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database deadlocks <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database numbackends <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_commit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database xact_rollback <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_read <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database blks_hit <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_returned <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_fetched <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_inserted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_updated <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database tup_deleted <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database conflicts <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_files <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database temp_bytes <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database deadlocks <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database stats_reset <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_tablespace <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_lock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_snapshot <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_bufferpin <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_deadlock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_tablespace <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_lock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_snapshot <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_bufferpin <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_deadlock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_tablespace <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_lock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_snapshot <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_bufferpin <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_deadlock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_tablespace <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_lock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_snapshot <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_bufferpin <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_deadlock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_tablespace <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_lock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_snapshot <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_bufferpin <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=error msg="Unexpected error parsing column:  pg_stat_database_conflicts confl_deadlock <nil>" file="postgres_exporter.go" line=334
time="2016-05-20T00:06:41Z" level=info msg="Starting Server: :9113" file="postgres_exporter.go" line=377

error during postgres upgrade

Hi,
We're using postgres_exporter to monitor our server which is currently running 9.3.
An attempt to upgrade it to 9.6, using pg_upgrade failed with the following error:

pg_restore: creating VIEW "postgres_exporter.pg_stat_activity"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 175; 1259 1807049 VIEW pg_stat_activity postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  column reference "query" is ambiguous
LINE 29:     "f_select_pg_stat_activity"."query"

It was a in-place pg_upgrade on the same server, running Ubuntu 16.04 using postgresql packages from postgresql.org repository.
Not directly related to the exporter working, which had been working great but still someone might had faced this issue at some point.

Any idea what could had triggered that error?

pg_replication_slots.active_pid does not exist

Pull request #23 has introduced a regression: the query against pg_stat_replication now joins with pg_replication_slots on pg_stat_replication.pid=pg_replication_slots.active_pid. But pg_replication_slots.active_pid is not a valid column, see https://www.postgresql.org/docs/9.4/static/catalog-pg-replication-slots.html. In light of that and the fact that pg_replication_slots is only present in 9.4 (not in 9.2, 9.5, etc) I suggest reverting this change altogether.

Failed converting result to metric: max_standby_streaming_delay

This is actually weird error and only happened on our master server with three slaves. The process runs fine but there's this error that keeps going:

ERRO[1747] Failed converting result to metric: max_standby_streaming_delay [49 109 105 110] time: unknown unit min in duration 1min  source=postgres_exporter.go:590

Is this because of the number of slaves (three)? Is there anything I can modify to make this error go away.

Check version with `-version`?

How to determine the current postgre_expoter version? I notice that there is -version argument on postgres_exporter.

Thank you for maintaining postgres_exporter.

queries.yml to docker

Is it possible to provide quries.yml to docker?
I don't have GO compilator.

docker-compose.yml
version: '3.1'
services:
prometheus:
build: prometheus
ports:
- 9090:9090
grafana:
image: grafana/grafana
ports:
- 3000:3000
db:
image: postgres
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: password
volumes:
- '/var/lib/postgresql/data'
exporter:
image: wrouesnel/postgres_exporter
ports:
- 9187:9187
depends_on:
- db
environment:
DATA_SOURCE_NAME: postgresql://postgres:password@docker-vm:5432/postgres

Dockerfile
FROM prom/prometheus
ADD prometheus.yml /etc/prometheus/prometheus.yml

prometheus.yml
scrape_configs:

  • job_name: 'example-postgres'
    scrape_interval: 5s
    static_configs:
    • targets: ['docker-vm:9187']

WAL control functions cannot be executed during recovery

Hot standby servers cannot run WAL control functions so these should probably be skipped

2017-02-18 04:26:12 UTC ERROR: recovery is in progress
2017-02-18 04:26:12 UTC HINT: WAL control functions cannot be executed during recovery.
2017-02-18 04:26:12 UTC STATEMENT:
SELECT *,
pg_current_xlog_location(),
pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float
FROM pg_stat_replication

Error scanning version string: on Postgres 9.5

Getting the following error:

"Proceeding with outdated query maps, as the Postgres version could not be determined: Error scanning version string: pq: SSL is not enabled on the server."

Server is 9.5. This happens whether connecting locally ( as user postgres ) or remotely (also as a superuser). It is true that SSL is not enabled.

pg_exporter_last_scrape_error 1

Let me know if you need further information from me.

Huge number of open file descriptors after days of running

Hi Will,

We've been running pg exporters for the last 2 weeks, and we noticed that they leaked file descriptors.

Here's a list of some pg exporters running on our site, the 2nd column being the open fds on the docker daemon and names have been masked:

prometheus-postgres-xxxxxxxxx-replica  18959
prometheus-postgres-xxxxxxxxx-master   11800
prometheus-postgres-xxxxxxxxx-master   11780
prometheus-postgres-xxxxxxxxx-master   11796
prometheus-postgres-xxxxxxxxx-master   11790
prometheus-postgres-xxxxxxxxx-master   11782
prometheus-postgres-xxxxxxxxx-master   11810
prometheus-postgres-xxxxxxxxx-replica  2868
prometheus-postgres-xxxxxxxxx-replica  2870
prometheus-postgres-xxxxxxxxx-replica  2875
prometheus-postgres-xxxxxxxxx-replica  2872
prometheus-postgres-xxxxxxxxx-replica  2862
prometheus-postgres-xxxxxxxxx-replica  2875

As a result, this exposes a docker bug, where even destroying those containers, leaves fds deleted but still open on the docker daemon.

Here's a list of open fd count on our DB servers:

docker_fd_count                      125996
docker_fd_count                                373688
docker_fd_count                           484407
docker_fd_count                            520493

The last one is at half a million open fds, and it runs our masters.

docker ps just hangs indefinitely.

To reproduce this bug, just run an exporter and wait, open fds on docker daemon will keep growing.

Thank you

Option to not query replication stats

The databases that I currently monitor do not have replication enabled, so every time Prometheus scrapes the exporter, I get these messages in the logs:

Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-1] ERROR:  relation "pg_replication_slots" does not exist at character 162
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-2] STATEMENT:
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-3]             SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-4]                     INNER JOIN pg_replication_slots ON pg_stat_replication.pid=pg_replication_slots.active_pid

It'd be good if there was a command line switch to turn off these queries, it'd be GREAT if the exporter could determine that replication wasn't in use automatically and not issue these queries.

Support pg_stat_statements robustly

The proposal in #35 needs some careful analysis before merging.

The most important aspect is that the queries.yaml file we currently include is not included as part of the integration testing because it is not enabled by default.

Most likely we need a whole new testing regime for it and to ensure the file is separated into PG -specific versions.

Missing dependencies

After launching the Make
make -C tools make[1]: Entering directory '/opt/postgres_exporter/postgres_exporter-0.2.1/tools' make[1]: Nothing to be done for 'DEFAULT'. make[1]: Leaving directory '/opt/postgres_exporter/postgres_exporter-0.2.1/tools' gometalinter --disable-all --enable=gofmt --vendor Using 2 processes gometalinter -j 2 --deadline=30s --disable=gotype --disable=gocyclo pg_setting.go:11:2:warning: could not import github.com/prometheus/client_golang/prometheus (cannot find package "github.com/prometheus/client_golang/prometheus" in any of: (staticcheck) pg_setting.go:12:2:warning: could not import github.com/prometheus/common/log (cannot find package "github.com/prometheus/common/log" in any of: (staticcheck) postgres_exporter.go:19:2:warning: could not import gopkg.in/yaml.v2 (cannot find package "gopkg.in/yaml.v2" in any of: (staticcheck) postgres_exporter.go:21:2:warning: could not import github.com/blang/semver (cannot find package "github.com/blang/semver" in any of: (staticcheck) postgres_exporter.go:22:4:warning: could not import github.com/lib/pq (cannot find package "github.com/lib/pq" in any of: (staticcheck) postgres_exporter.go:23:2:warning: could not import github.com/prometheus/client_golang/prometheus (cannot find package "github.com/prometheus/client_golang/prometheus" in any of: (staticcheck) postgres_exporter.go:24:2:warning: could not import github.com/prometheus/common/log (cannot find package "github.com/prometheus/common/log" in any of: (staticcheck) pg_setting.go:16:30:warning: undeclared name: prometheus (staticcheck) pg_setting.go:50:30:warning: undeclared name: prometheus (staticcheck) postgres_exporter.go:107:30:warning: undeclared name: semver (staticcheck) postgres_exporter.go:111:42:warning: undeclared name: semver (staticcheck) postgres_exporter.go:125:20:warning: undeclared name: semver (staticcheck) postgres_exporter.go:144:13:warning: undeclared name: prometheus (staticcheck) postgres_exporter.go:145:14:warning: undeclared name: prometheus (staticcheck) postgres_exporter.go:218:76:warning: undeclared name: semver (staticcheck) postgres_exporter.go:219:76:warning: undeclared name: semver (staticcheck) postgres_exporter.go:235:106:warning: undeclared name: semver (staticcheck) postgres_exporter.go:246:85:warning: undeclared name: semver (staticcheck) postgres_exporter.go:251:55:warning: undeclared name: semver (staticcheck) postgres_exporter.go:262:15:warning: undeclared name: semver (staticcheck) postgres_exporter.go:271:4:warning: undeclared name: semver (staticcheck) postgres_exporter.go:295:4:warning: undeclared name: semver (staticcheck) postgres_exporter.go:304:4:warning: undeclared name: semver (staticcheck) postgres_exporter.go:316:4:warning: undeclared name: semver (staticcheck) postgres_exporter.go:349:37:warning: undeclared name: semver (staticcheck) postgres_exporter.go:380:47:warning: undeclared name: semver (staticcheck) postgres_exporter.go:477:28:warning: undeclared name: semver (staticcheck) ...

So i tryed to just make postgres_exporter:
fatal: Not a git repository (or any parent up to mount point /opt) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). postgres_exporter.go:21:2: cannot find package "github.com/blang/semver" in any of: /usr/lib/go-1.6/src/github.com/blang/semver (from $GOROOT) /opt/postgres_exporter/postgres_exporter-0.2.1/src/github.com/blang/semver (from $GOPATH) postgres_exporter.go:22:2: cannot find package "github.com/lib/pq" in any of: /usr/lib/go-1.6/src/github.com/lib/pq (from $GOROOT) /opt/postgres_exporter/postgres_exporter-0.2.1/src/github.com/lib/pq (from $GOPATH) pg_setting.go:11:2: cannot find package "github.com/prometheus/client_golang/prometheus" in any of: /usr/lib/go-1.6/src/github.com/prometheus/client_golang/prometheus (from $GOROOT) /opt/postgres_exporter/postgres_exporter-0.2.1/src/github.com/prometheus/client_golang/prometheus (from $GOPATH) pg_setting.go:12:2: cannot find package "github.com/prometheus/common/log" in any of: /usr/lib/go-1.6/src/github.com/prometheus/common/log (from $GOROOT) /opt/postgres_exporter/postgres_exporter-0.2.1/src/github.com/prometheus/common/log (from $GOPATH) postgres_exporter.go:19:2: cannot find package "gopkg.in/yaml.v2" in any of: /usr/lib/go-1.6/src/gopkg.in/yaml.v2 (from $GOROOT) /opt/postgres_exporter/postgres_exporter-0.2.1/src/gopkg.in/yaml.v2 (from $GOPATH) make: *** [postgres_exporter] Error 1

Manual solution:
export GOPATH=pwd go get github.com/blang/semver go get github.com/lib/pq go get github.com/prometheus/common/log go get github.com/prometheus/client_golang/prometheus go get gopkg.in/yaml.v2 go get gopkg.in/check.v1 make postgres_exporter

System information:

Downloaded tar file: v0.2.1.tar.gz

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

apt-get install golang

Container in docker swarm throws panic: runtime error: invalid memory address or nil pointer dereference

This error is thrown when I run the postgres_exporter container as a service inside docker swarm

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x6fbe6a]

goroutine 18 [running]:
main.(*Exporter).scrape(0xc4201080c0, 0xc42010c1e0)
	/home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/postgres_exporter.go:956 +0x25a
main.(*Exporter).Collect(0xc4201080c0, 0xc42010c1e0)
	/home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/postgres_exporter.go:744 +0x39
main.(*Exporter).Describe(0xc4201080c0, 0xc42010c180)
	/home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/postgres_exporter.go:737 +0xb0
github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*registry).Register.func1(0x9459c0, 0xc4201080c0, 0xc42010c180)
	/home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:218 +0x3b
created by github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*registry).Register
	/home/travis/gopath/src/github.com/wrouesnel/postgres_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:220 +0xbc

Observations

  • It works well when I run the container as standalone container in same server
  • The DATA_SOURCE_NAME is set properly. I've verified this by getting inside container (I had to create docker image with alpine linux for debugging this)
/ # env
DATA_SOURCE_NAME="postgresql://postgres_exporter:[email protected]:5432/postgres"
  • I've verified that psql client can connect to postgres using same connection string
apk --update add postgresql-client
/ # psql "postgresql://postgres_exporter:[email protected]:5432/postgres"
psql (9.6.3, server 9.5.7)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=#
  • Dockerfile used for creating image for debugging
FROM alpine:3.6

ARG POSTGRES_EXPORTER_VERSION=v0.2.1

RUN apk --no-cache add openssl

RUN wget -O /usr/local/bin/postgres_exporter https://github.com/wrouesnel/postgres_exporter/releases/download/$POSTGRES_EXPORTER_VERSION/postgres_exporter && \
    chmod +x /usr/local/bin/postgres_exporter

EXPOSE 9187

ENTRYPOINT ["/usr/local/bin/postgres_exporter"]

Unable to get a shell

I'm trying to do some trouble shooting by getting a shell on the docker container. I've tried everything I can think of, but it seems that /bin/bash or /bin/sh don't exists on the image.

sudo docker run -t -i --entrypoint /bin/bash wrouesnel/postgres_exporter
docker: Error response from daemon: Container command '/bin/bash' not found or does not exist..

Is there some other way I can get a shell, so that I can test if it's able to connect to the db? The actual error that I'm trying to solve is this, which I'm assuming is a connectivity issue:
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database_conflicts missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_bgwriter missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277

Postgres 10 beta support

It'll be nice to release version which supports Postgres 10 beta

 PostgreSQL 10beta1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204, 64-bit\n" source="postgres_exporter.go:966" 

Lint failure

On trying to build today, I am getting a failure on the lint step:

postgres_exporter@alpha-postgres-1:~/postgres_exporter_repo$ make
make -C tools
make[1]: Entering directory '/home/postgres_exporter/postgres_exporter_repo/tools'
make[1]: Nothing to be done for 'DEFAULT'.
make[1]: Leaving directory '/home/postgres_exporter/postgres_exporter_repo/tools'
gometalinter --disable-all --enable=gofmt --vendor
Using 1 processes
gometalinter -j 1 --deadline=30s --disable=gotype --disable=gocyclo 
postgres_exporter.go:1008:27:warning: prometheus.Handler is deprecated: Please note the issues described in the doc comment of InstrumentHandler. You might want to consider using promhttp.Handler instead (which is not instrumented, but can be instrumented with the tooling provided in package promhttp).  (SA1019) (staticcheck)
Makefile:39: recipe for target 'lint' failed
make: *** [lint] Error 1

This was working fine last time I tested, but I am not sure how long ago that was now

FR. lock type monitoring

Hello! Thank you for job!

Can you add pg_stat_activity from PostgreSQL 9.6 (wait_event_type, etc)

Multiple Data Sources

Hi all,

would be possible to have multiple DATA_SOURCE ?? We would use the exporter for a microservices architecture with various Postgres data bases.
Thanks

WARN[0000] Postgres version could not be determined

Hi,

I'm using latest postgresql 9.4 release (9.4.10) on CentOS 7.3. When i run postgres_exporter, i'm getting following error:

"WARN[0000] Postgres version could not be determined. Proceeding with outdated query maps. source=postgres_exporter.go:987".

Provide alerts example

I can't found examples on how to monitor this metrics, it'll be useful if this project provide some examples.

For now I'm just using one alert to check if the max connections is 80% > max connections.

    ALERT PostgresqlHighMaxConnections
      IF sum(pg_runtime_variable_max_connections * 0.8) -  sum(pg_stat_activity_count) == 0 OR absent(pg_runtime_variable_max_connections)
      FOR 2m
      LABELS {
        service = "postgresql",
        severity = "critical",
      }
      ANNOTATIONS {
        summary = "Connections is too high",
        description = "Postgresql reachs 80% of the max connections",
      }

@wrouesnel Is here the right place to ask for contributions?

Documentation should explain how docker interacts with the database

Steps to Reproduce:

  1. Verify database user and password:
psql --host 127.0.0.1 --port 5432 --username postgres_exporter postgres
Password for user postgres_exporter: 
psql (9.5.7)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

postgres=> 
  1. Docker run with:
docker run -e DATA_SOURCE_NAME="postgresql://postgres_exporter:[email protected]:5432/postgres?sslmode=disable" -p 9187:9187 wrouesnel/postgres_exporter
  1. Result:
level=info msg="Error opening connection to database (could not parse DATA_SOURCE_NAME): dial tcp 127.0.0.1:5432: getsockopt: connection refused" source="postgres_exporter.go:959" 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.