pgstef / check_pgbackrest

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

Perl warning errors when running the check_pgbackrest command #35

Closed m0nt3cr1st0 closed 1 year ago

m0nt3cr1st0 commented 1 year ago

Versions:

Hello! It seems that after upgrading my pgbackrest version from 2.46 to 2.47 the output of check_pgbackrest started to contain Perl warnings too:

$ sudo ./check_pgbackrest --service=archives --stanza=db01 --latest-archive-age-alert=12h
Use of uninitialized value $oldest_bck_archive_start in string lt at ./check_pgbackrest line 1047.
Use of uninitialized value $latest_bck_archive_start in concatenation (.) or string at ./check_pgbackrest line 1126.
Use of uninitialized value in concatenation (.) or string at ./check_pgbackrest line 1127.
Use of uninitialized value in concatenation (.) or string at ./check_pgbackrest line 1128.
Use of uninitialized value $oldest_bck_archive_start in concatenation (.) or string at ./check_pgbackrest line 1130.
Use of uninitialized value in concatenation (.) or string at ./check_pgbackrest line 1131.
Use of uninitialized value in concatenation (.) or string at ./check_pgbackrest line 1132.
WAL_ARCHIVES OK - 868 unique WAL archived, latest archived since 49s | latest_archive_age=49s num_unique_archives=868

I can read code but I have 0 experience with Perl, but it seems that by adding: no warnings 'uninitialized'; at the top of the file I get rid of these, but I'm reporting it just in case is something worth fixing!

Thanks for your great job maintaining this project! (L)

pgstef commented 1 year ago

Hi,

I can't reproduce that issue unfortunately:

$ check_pgbackrest --version
check_pgbackrest version 2.2, Perl 5.26.3
$ pgbackrest version
pgBackRest 2.47
$ check_pgbackrest --service=archives --stanza=ro8pg --latest-archive-age-alert=12h
WAL_ARCHIVES OK - 5 unique WAL archived, latest archived since 13m13s | latest_archive_age=793s num_unique_archives=5

Could you give a bit more context please? (run check_pgbackrest with --debug, pgbackrest config, pgbackrest info --output=text and --output=json examples,...)

Also no warnings 'uninitialized'; won't solve the underlying error, just masking it (which could hide a bigger problem in the future). Those values should be initialized. I'll add more debug output if I can't reproduce your situation.

Kind Regards

m0nt3cr1st0 commented 1 year ago

Mmmm weird, it seems I can't reproduce the error myself anymore either. I can also confirm that the versions from perl, pgbackrest and check_pgbackrest haven't changed, so maybe a library that the check was using?

Anyways, this can be closed as the issue is gone now.

Thanks for looking into it!