pgstef / check_pgbackrest

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

=head1 NAME

check_pgbackrest - pgBackRest backup check plugin for Nagios

=head1 SYNOPSIS

check_pgbackrest [-s|--service SERVICE] [-S|--stanza NAME] check_pgbackrest [-l|--list] check_pgbackrest [--help]

=head1 DESCRIPTION

check_pgbackrest is designed to monitor pgBackRest (2.52 and above) backups from Nagios.

=over

=item B<-s>, B<--service> SERVICE

The Nagios service to run. See section SERVICES for a description of available services or use C<--list> for a short service and description list.

=item B<-S>, B<--stanza> NAME

Name of the stanza to check.

=item B<--repo> REPOSITORY

Repository index to operate on. If no C<--repo> argument is provided, the service will operate on all repositories defined, checking for inconsistencies across multiple repositories. When using multiple repositories, it is recommended to also define checks using the C<--repo> argument to verify the sanity of each repository separately.

=item B<-O>, B<--output> OUTPUT_FORMAT

The output format. Supported outputs are: C, C, C (default), C and C.

The C output format will filter out unsupported types of values from the performance data.

=item B<-C>, B<--command> FILE

pgBackRest executable file (default: "pgbackrest").

=item B<-c>, B<--config> CONFIGURATION_FILE

pgBackRest configuration file.

=item B<-P>, B<--prefix> COMMAND

Some prefix command to execute the pgBackRest info command (eg: "sudo -iu postgres").

=item B<-l>, B<--list>

List available services.

=item B<--debug>

Print some debug messages.

=item B<-V>, B<--version>

Print version and exit.

=item B<-?>, B<--help>

Show this help page.

=back

=head2 SERVICES

Descriptions and parameters of available services.

=over

=item B

Fail when the number of full backups is less than the C<--retention-full> argument.

Fail when the number of differential backups is less than the C<--retention-diff> argument.

Fail when the number of incremental backups is less than the C<--retention-incr> argument.

Fail when the newest backup is older than the C<--retention-age> argument.

Fail when the newest full backup is older than the C<--retention-age-to-full> argument.

Fail when the oldest backup is newer than the C<--retention-age-to-oldest> argument.

The following units are accepted (not case sensitive): s (second), m (minute), h (hour), d (day). You can use more than one unit per given value.

Arguments are not mandatory to only show some information.

=item B

Check if all archived WALs exist between the oldest and the latest WAL needed for the recovery.

Use the C<--wal-segsize> argument to set the WAL segment size.

The following units are accepted (not case sensitive): b (Byte), k (KB), m (MB), g (GB), t (TB), p (PB), e (EB) or Z (ZB). Only integers are accepted. Eg. C<1.5MB> will be refused, use C<1500kB>.

The factor between units is 1024 bytes. Eg. C<1g = 1G = 1024*1024*1024.>

Use the C<--ignore-archived-before> argument to ignore the archived WALs generated before the provided interval. Used to only check the latest archives.

Use the C<--ignore-archived-after> argument to ignore the archived WALs generated after the provided interval.

The C<--latest-archive-age-alert> argument defines the max age of the latest archived WAL as an interval before raising a critical alert.

The following units are accepted as interval (not case sensitive): s (second), m (minute), h (hour), d (day). You can use more than one unit per given value. If not set, the last unit is in seconds. Eg. "1h 55m 6" = "1h55m6s".

All the missing archives are only shown in the C<--debug> mode.

Use C<--list-archives> in addition with C<--debug> to print the list of all the archived WAL segments.

Use C<--list-boundaries> in addition with C<--debug> to print the list of all the boundary WAL segments fetched from the history files.

By default, all the archives older than the oldest backup start archive or newer than the max_wal returned by the pgBackRest info command are ignored.

Use the C<--extended-check> argument to force a full check of the found archives and raise warnings in case of inconsistencies.

When WAL archives on different timelines are found, .history files are parsed to find the switch point and define the boundary WAL.

Use the C<--max-archives-check-number> to prevent infinite WAL archives check when boundary WAL can't be defined properly.

In case of pgBackRest db history change (after a successful stanza-upgrade), only the latest db system/version will be checked.

=item B

Check if this script is running a given version.

You must provide the expected version using C<--target-version>.

=item B

Check if pgBackRest is running a given version.

You must provide the expected version using C<--target-version>.

=back

=head1 CONTRIBUTING

check_pgbackrest is an open project. Any contribution to improve it is welcome.

=head1 VERSION

check_pgbackrest version 2.4, released on Fri Jul 05 2024.

=head1 LICENSING

This program is open source, licensed under the PostgreSQL license. For license terms, see the LICENSE file.

=head1 AUTHORS

Author: Stefan Fercot.

Logo: Damien Cazeils (www.damiencazeils.com).

Copyright: (c) 2018-2020, Dalibo / 2020-2024, Stefan Fercot.