lesovsky / zabbix-extensions

Zabbix additional monitoring modules
BSD 3-Clause "New" or "Revised" License
316 stars 230 forks source link

pgbouncer discovery not working #76

Closed dan-aksenov closed 4 years ago

dan-aksenov commented 4 years ago

Hello. script pgbouncer.pool.discovery.sh gives following error:

ERROR:  invalid command 'SELECT d.datname as "Name",
       pg_catalog.pg_get_userbyid(d.datdba) as "Owner",
       pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding",
       pg_catalog.array_to_string(d.datacl, '\n') AS "Access privileges"
FROM pg_catalog.pg_database d
ORDER BY 1;', use SHOW HELP;

I think it's problem using psql with -l key on line 14, which tries to execute select statement in bouncer mode.

poollist=$(psql -h $hostname -p $port -U $username -tAF: --dbname=$dbname -c "show pools" |cut -d: -f1,2 |grep -v ^pgbouncer)

After removing -l key scripts works fine for me.

stephankn commented 4 years ago

@lesovsky I think you created that script. Can you comment on the -l option?

For me it sounds strange to combine it with a query command. Is it a typo and a different option was intended? Otherwise it sounds safe to remove it. I sm not using pgbouncer so I can not test it.

@dan-aksenov does everything else works fine with the -l removed?

lesovsky commented 4 years ago

'-l' can be safely removed. This option is used in psql for list databases and in this script is unnecessary.