Commit Graph

100 Commits

Author SHA1 Message Date
Will Rouesnel
54a0cf0e63
Fix build error introduced by pg_archiver metrics bad merge.
2772da8dbe was missing an additional
parameter. This fixes the build.
2019-11-25 23:50:43 +11:00
Russ Garrett
2772da8dbe Export pg_stat_archiver metrics
These are useful for knowing if WAL archiving is working successfully.
2019-11-20 10:21:50 +11:00
sfalkon
c4508ff430 Refactoring: fix error 2019-11-20 10:18:20 +11:00
sfalkon
d74818ccac fix integration test 2019-11-20 10:18:20 +11:00
sfalkon
deac1c37db fix master database behavior 2019-11-20 10:18:20 +11:00
Benjamin P. Jung
9b13f5ec57 Add support for 'DATA_SOURCE_URI_FILE' envvar.
Closes #326 as is provides a viable solution to use a K8S init container
to fully contruct the PostgreSQL URI and 'hand it over' to the postgres_exporter
process.
2019-11-20 10:17:31 +11:00
Will Rouesnel
34fdb69ee2
Add support for optional namespace caching. (#319)
In the user queries.yml file, the created namespaces can now be optionally
cached by setting cache_seconds, which will prevent the query being re-run
within that timeframe if previous results are available.

Supercedes #211, credit to @SamSaffron for the original PR.
2019-11-01 00:17:31 +11:00
sfalkon
1385b4f658 Fix some autodiscovery problems (#314)
* Fix problem: If autodiscovery is enable exporter make connection twice to database from connetion string (exclude current database from SQL-query);

* Fix problem: don't get default metrics and settings if autodiscovery is enabled. Now you can use --disable-default-metrics and --disable-settings-metrics with --auto-discover-databases and
2019-10-31 22:09:30 +11:00
Alexis Sellier
ececfdeab7 Yaml parsing refactor (#299)
* Use struct instead of interface{} when parsing query user

* Use MappingOptions

* Split function to be more testable

* Rename function to parseUserQueries

* Start to add test about query parsing
2019-10-31 22:07:59 +11:00
Daniel Pintara
e1428a8330 Don't stop generating fingerprint while encountering value with "=" sign (#318) 2019-10-31 22:02:27 +11:00
Michael Kaye
d6f7ff1641 Expose pg_current_wal_lsn_bytes (#307) 2019-10-30 14:57:54 +11:00
Leo Antunes
e362f444aa [minor] fix landing page content-type (#305) 2019-10-30 14:57:12 +11:00
Dan Molik
043e68e067 Add retries to getServer() (#316)
Some backstory
==============

I was attempting to use postgres_exporter with the official Docker
container (https://hub.docker.com/_/postgres) In a Kubernetes
StatefulSet, with a side-car configuration, but found that I wasn't able
to connect even with sharing the Postgres Unix listening socket, between
both containers. After copying the container over to an Alpine base I
quickly found out that the postgres_exporter was actually starting
before the main Postres container had dropped the unix socket onto the
file system, a quick work around is to write a bash for loop checking
for the existence of a unix socket, however this would require
maintaining a container, besides other users may find retries useful on
startup.

Implementation
==============

All changes are made to the getServer function and variables are
local, I was unsure if it was worth adding command line switches but
this would allow for a more sophisticated backOff loop in the future.

Hope this help, and let me know if you would like me to changes
anything.
2019-10-30 14:54:18 +11:00
Dmitry Ulyanov
238f5c099a Fix pg_up metric returns last calculated value without explicit resetting (#291)
If exporter is scraped by multiple Prometheuses (as we do) - Collect() could be called concurrently. In result in some cases one of Prometheuses could get pg_up = 0, because it was explicitly set to zero on first Collect call.
2019-08-12 13:35:58 +10:00
Alexis Sellier
1ab8d2bbc8 Discover only databases that are not templates and allow connections (#297)
* Discover only databases that are not templates and allow connections

* Update readme
2019-08-12 11:40:58 +10:00
Alexis Sellier
c768e64548 Add --exclude-databases option (#298)
* Add exclude-databases option
* Update readme to explain --exclude-databases
* Add comments to ExcludeDatabases function and unexport Contains function
2019-08-12 11:25:01 +10:00
Richard Kojedzinszky
5f3a711ebd Use application_name column as a label 2019-07-12 10:26:33 +10:00
Will Rouesnel
0d7891de1a
Fix smoke-tests to more reliably use pg_isready. 2019-07-03 23:14:20 +10:00
Arno Geurts
85c31524f6 Fix build for auto-discover-databases feature 2019-07-03 22:17:15 +10:00
Arno Geurts
4d96104c10 Add documentation for auto-discover-databases 2019-07-03 22:17:15 +10:00
Arno Geurts
58043f72da Add option to automatically discover database names 2019-07-03 22:17:15 +10:00
Miguel Hernandez
2b896ea2df add support for boolean data types as metrics
This is useful if your database uses true/false for state and want to make prometheus alerts based on that.
Before, booleans were not able to be parsed.  See issue #201
2019-07-01 08:44:56 +10:00
Alexey Palazhchenko
84a575f29f Group and sort imports. 2019-07-01 08:43:47 +10:00
SamB
0d4af2b71c No version metrics when default metrics disabled 2019-07-01 08:42:40 +10:00
Asher Foa
c9dc7a20a1 remove unsupported postgres versions 2019-06-15 19:38:40 +10:00
Anthony Regeda
734dc50972 fix-panic-on-shutdown-server added test for const values parsing 2019-03-02 12:34:59 +10:00
Anthony Regeda
725b163161 fix-panic-on-shutdown-server fix panic on shutdown server 2019-03-02 12:34:59 +10:00
Anthony Regeda
6d2cae6fa8 fix-param-env-key fix spelling of env parameter 2019-01-04 00:32:12 +11:00
Anthony Regeda
1d6a733ba2 multi-server-exporter multi server exporter is introduced 2018-12-19 01:46:45 +11:00
Will Rouesnel
93736366d9
Update goimport/gofmt of files. 2018-11-11 16:05:05 +11:00
Will Rouesnel
474a600842
Add Postgresql 11 to smoke-tests. 2018-11-11 15:40:09 +11:00
Will Rouesnel
414e9b13c2
Remove -x from smoke-test. 2018-11-11 15:39:51 +11:00
Will Rouesnel
99ff02c6a9
Fix the errors introduced into smoke-test from the refactor. 2018-11-11 15:34:33 +11:00
Will Rouesnel
43072ddaa7
Improve support code quality. 2018-11-11 15:07:07 +11:00
Greg Stark
5452a3aac6 Postgres commits 6e7baa3227 and b06d8e58b5 added a new unit suffix "B"
for memory parameters for bytes.
2018-11-03 01:23:01 +11:00
Robson Roberto Souza Peixoto
c225a1e194 Accept constantLabels as parameters
When you area monitoring server from cloud providers the exporter
IP/hostname is not the server IP, so add some constant labels is useful
on dashboards and alerts.

And is very important to use with `--disable-default-metrics` to add
info like `datname` and figure out the database name that you are
monitoring
2018-09-22 15:47:35 +10:00
tshohe
763159e1d2 add query for v9.1 (#203) 2018-07-17 01:18:08 +10:00
Marc Bachmann
05429f2d1c Fix comments about DATA_SOURCE_* environment variable usage 2018-06-19 23:05:16 +10:00
Adam Harrison
3f905289a2 URL encode username/password fields
Fixes #188.
2018-05-23 10:42:19 +10:00
Will Rouesnel
9eff17a257 Fix the replication test. 2018-05-23 01:06:52 +10:00
Will Rouesnel
2db74865b1 Fix lint and fmt errors. 2018-04-15 23:31:18 +10:00
Will Rouesnel
d5caaf5a4d Fix issue #174
Postgres can emit 32MB and 64MB units which were previously unhandled. Handle them.
2018-04-15 23:31:18 +10:00
Will Rouesnel
771eb94ea8 Add test case which reproduces issue #173 2018-04-15 23:31:18 +10:00
Hang Sun
f00c4b7b87 Added command-line flag to disable the default metrics 2018-03-21 00:28:59 +11:00
Hang Sun
2db8b47fe8 Added a new unit 32kB 2018-03-21 00:28:29 +11:00
Will Rouesnel
5abe56d1fc Fix new linter issues. 2018-03-07 05:25:17 +10:00
Will Rouesnel
9118b7c814 Fix bad gofmt'ing. 2018-03-07 05:25:17 +10:00
Will Rouesnel
fa2c1e8f0f Fix pg_up never being set to 1 (introduced by #162).
Correct fix for #160.
2018-03-07 05:25:17 +10:00
Will Rouesnel
4117fb2afc Ensure pg_up is always set to 0 when the initial database connection fails.
This did in fact turn out to be an oversight in the error handling. Now, any
error in the initial connection path will always trip pg_up to be 0.

Fixes #160
2018-03-06 07:57:44 +10:00
Will Rouesnel
989489096e Refactor repository layout and convert build system to Mage.
This commit implements a massive refactor of the repository, and
moves the build system over to use Mage (magefile.org) which should
allow seamless building across multiple platforms.
2018-03-06 07:29:35 +10:00