Go to file
Will Rouesnel 5428cf141f Update README.md 2015-08-28 07:08:54 +10:00
.gitignore Update gitignore 2015-08-28 04:29:03 +10:00
Dockerfile Compiling version of the postgres_exporter. 2015-08-25 03:28:41 +10:00
LICENSE Compiling version of the postgres_exporter. 2015-08-25 03:28:41 +10:00
Makefile Compiling version of the postgres_exporter. 2015-08-25 03:28:41 +10:00
Makefile.COMMON Compiling version of the postgres_exporter. 2015-08-25 03:28:41 +10:00
README.md Update README.md 2015-08-28 07:08:54 +10:00
postgres_exporter.go Fix the column labeling properly. 2015-08-28 06:58:59 +10:00

README.md

PostgresSQL Server Exporter

Prometheus exporter for PostgresSQL server metrics. Supported Postgres versions: 9.1 and up.

Building and running

make
export DATA_SOURCE_NAME="postgres://postgres:password@localhost/?sslmode=disable"
./postgres_exporter <flags>

See the github.com/lib/pg module for other ways to format the connection string.

Flags

Name Description
web.listen-address Address to listen on for web interface and telemetry.
web.telemetry-path Path under which to expose metrics.

Setting the Postgres server's data source name

The PostgresSQL server's data source name must be set via the DATA_SOURCE_NAME environment variable.

Adding new metrics

The exporter will attempt to dynamically export additional metrics if they are added in the future, but they will be marked as "untyped". Additional metric maps can be easily created from Postgres documentation by copying the tables and using the following Python snippet:

x = """tab separated raw text of a documentation table"""
for l in StringIO(x):
    column, ctype, description = l.split('\t')
    print """"{0}" : {{ prometheus.CounterValue, prometheus.NewDesc("pg_stat_database_{0}", "{2}", nil, nil) }}, """.format(column.strip(), ctype, description.strip())

Adjust the value of the resultant prometheus value type appropriately. This helps build rich self-documenting metrics for the exporter.