Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql_extensible plugin does not have switcher to disable server_version_num checker #2660

Closed
kotopes opened this issue Apr 12, 2017 · 4 comments
Labels
bug unexpected problem or unintended behavior

Comments

@kotopes
Copy link
Contributor

kotopes commented Apr 12, 2017

Bug report

I use telegraf postgresql_extensible plugin to grab metrics from pgbouncer, but in system log, i have some errors:

Apr 12 16:29:11 pgsql04 telegraf[140805]: 2017-04-12T13:29:11Z E! ERROR in input [inputs.postgresql_extensible]: pq: invalid command 'select substring(setting from 1 for 3) as version from pg_settings where name='server_version_num'', use SHOW HELP;
Apr 12 16:29:13 pgsql04 telegraf[140805]: 2017-04-12T13:29:13Z E! ERROR in input [inputs.postgresql_extensible]: pq: invalid command 'select substring(setting from 1 for 3) as version from pg_settings where name='server_version_num'', use SHOW HELP;

not have shitcher - disable_pgversion_check, no ignore checking pg version (in pgbouncer database not have pg_settings table)

Relevant telegraf.conf:

System info:

Ubuntu x64 16.04.2 LTS (Linux pgsql.local 4.4.0-66-generic #87-Ubuntu SMP)
telegraf=1.2.1-1
pgbouncer=1.7.2-2.pgdg16.04+1

Steps to reproduce:

input_pgbouncer_stats.conf

[[inputs.postgresql_extensible]]
  address = "host=/var/run/postgresql user=telegraf sslmode=disable dbname=pgbouncer port=6432"
  databases = ["pgbouncer"]

  [[inputs.postgresql_extensible.query]]
    sqlquery="show pools"
    withdbname = false
    measurement="postgresql_pgbouncer_6432_pools"

Additional info:

in plugin code:
https://github.com/influxdata/telegraf/blob/master/plugins/inputs/postgresql_extensible/postgresql_extensible.go#L139-L145

@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Apr 12, 2017
@danielnelson
Copy link
Contributor

Seems like a bug/mistake. If the version query does not succeed, we should continue with queries and treat the db_version as 0. This way queries with no version set will still run.

@kotopes Are you interested in submitting a PR?

@luvpreetsingh
Copy link

luvpreetsingh commented Apr 13, 2017

@kotopes Does this plugin postgresql_extensibel give us Live data about our db server ?

I am not getting it's concept, I will show you why.

postgres=# select tup_inserted, tup_fetched from pg_stat_database;
tup_inserted | tup_fetched
--------------+-------------
0 | 0
0 | 0
0 | 425511
0 | 407918
0 | 0
1011 | 413373
324 | 360500
1167 | 345411
1139 | 346655
787 | 342410
1049 | 328089
0 | 204959
1646 | 231987
892 | 205624
41 | 66538
0 | 41609
838 | 2591785
(17 rows)

This is a query run on one of the views provided by the Statistics collector of Postgresql.

But these numbers are ridiculous. Even I sum all of my rows in my databases, they will never sum to these, and also I have not used my postgresql in weeks, which directly means it is giving me old data.

please explain these numbers to me.

Is there any way I can get live data ?
I want the queries/second , clients connected, used memory, database number and other live data necessary. Is there a plugin OR any other tool for this ?

@danielnelson
Copy link
Contributor

@sLuvpreet33 Please only make comments about the reported bug here, in order to stay on topic and keep the history clear. You can ask for help over on the Community site.

@danielnelson
Copy link
Contributor

The version is now considered to be 0 if it cannot be determined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants