lesovsky/zabbix-extensions

monitoring postgresql

ivanzor opened this issue · 3 comments

I have problem with UserParameter

Item preprocessing step #1 failed: cannot extract value from json by path "$.idle_in_transaction": cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'ERROR: column "wait_event" does not exist
LINE 1: ...x_connections')::int) AS total_pct, sum(CASE WHEN wait_event...

Can you please specify which version of the template you are using? What is your zabbix and postgresql version?

template 3.4
zabbix 3.4.15
postgresql 9.5

ERROR: function pg_size_bytes(text) does not exist at character 117
then I installed extension fuzzystrmatch but error still at logs :)

I confirm this is a compatibiliy issue. The function pg_size_bytes was introduced in PostgreSQL 9.6.
With the template supposed to work with older versions as well I (for now) classify this as a bug.

Some functions fetch the individual configuration value for the block size (you could change this during compile time at least) using current_setting('block_size'). I believe some values had been returned as human readable by this function. Then the value in human-readable format it needs to be converted into bytes to do some math with the value.

For your issue, a quick work-around would be to fetch the curent value, convert it as needed into byes and replace it in the query in the postgresql.conf file.

psql -c "select current_setting('block_size');"

I quickly tried it with a running 9.6 version and it reports it in bytes which could be easily casted. I think I have to check other versions as it certainly had a reason that I used a converter function and not the config directly. If it was just that I had used it for fetching shared_buffers (no longer used), then I could rework it.

So your option is to either wait a day or two until I clarified this point and update the user script or just patch as indicated above.