pgstef / check_pgbackrest

pgBackRest backup check plugin for Nagios
PostgreSQL License
35 stars 14 forks source link

Malformed JSON #9

Closed jinverso closed 4 years ago

jinverso commented 4 years ago

Hi, I've installed check_pgbackrest on a Centos 7 by using yum according to instructions given in: https://pgstef.github.io/2020/02/06/check_pgbackrest_1_7.html

Postgres version= 9.6 Pgbackrest = 2.23

Executing as root:

check_pgbackrest --stanza=main --service=archives --repo-path=/var/lib/pgbackrest/archive --output=human

Error:

malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "DEBUG: command/c...") at /usr/bin/check_pgbackrest line 438.

Is it a bug?

Thank you

pgstef commented 4 years ago

Hi,

It seems like the pgbackrest info command returns some DEBUG messages.

First, we can try to figure out where those come from. We currently filter out ERROR and WARN output, DEBUG could be added to filter out if needed.

Could you please provide the result of :

How have you configured your pgbackrest ? In /etc/pgbackrest.conf ? Could you provide the content of that file too please ?

Kind regards

dwsteele commented 4 years ago

@pgstef You should consider explicitly setting --log-level-console=error when you call info to override any user settings.

pgstef commented 4 years ago

Indeed @dwsteele, nice idea. Thanks. Done : https://github.com/dalibo/check_pgbackrest/commit/998c5658e8ef519b900a569e19e421e39d9ea6a2.

@jinverso, that commit should fix your issue. You can try to run the master version to test it.

Kind regards,

jinverso commented 4 years ago

@pgstef , you were right, I set "debug" as for "log-level-console" parameter in the pgbackrest.conf earlier while trying to solve some other issue with backups.

It's not clear from "check_pgbackrest" documentation what log levels were valid but after lowering log level to "warn" the tool worked as a charm.

@dwsteele thank you for the advice, will test latest commit and let you know asap.

jinverso commented 4 years ago

@dwsteele problem solved! No error thrown with latest commit after setting log level console to "debug" or "detail" . Thank you very much.

pgstef commented 4 years ago

Hi, Since the latest commit fix this issue, I close it. Thanks for your feedback !