diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f5eea..33ac520 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ Changelog ========= +2022-07-08 v2.6: + + - add: new `session_stats` service to gather miscellaneous session statistics + - add: compatibility with PostgreSQL 14 + - change: service `autovacuum` does not show `max_workers` anymore for 8.2 and below + - change: various messages cleanup + - fix: `last_vacuum` and `last_analyse` to reports the correct oldest maintenance + - fix: service `check_oldest_idlexact` now use `state_change` instead of + `xact_start` to calculate the idle time + - fix: improve locking around the status file to avoid dead locks and status file truncation + - fix: possible division by 0 in `table_bloat` service + - fix: threshold check and support interval for service `check_stat_snapshot_age` + - fix: service `check_archiver` when a .history or .backup file is staled + - fix: service `sequences_exhausted` now checks also sequences that are not owned by a table column + - fix: service `check_archiver` when no WAL was ever archived + 2020-11-24 v2.5: - add: new `oldest_xmin` service diff --git a/README b/README index 3127ae7..45ccde1 100644 --- a/README +++ b/README @@ -102,8 +102,16 @@ COMPATIBILITY --status-file PATH Path to the file where service status information is kept between - successive calls. Default is to save check_pgactivity.data in the - same directory as the script. + successive calls. Default is to save a file called + "check_pgactivity.data" in the same directory as the script. + + Note that this file is protected from concurrent writes using a lock + file located in the same directory, having the same name than the + status file, but with the extension ".lock". + + On some plateform, network filesystems may not be supported + correctly by the locking mechanism. See "perldoc -f flock" for more + information. --dump-status-file Dump the content of the status file and exit. This is useful for @@ -430,6 +438,18 @@ COMPATIBILITY role, in each database of the cluster: "GRANT SELECT ON pg_statistic TO pg_monitor;" + session_stats (14+) + Gather miscellaneous session statistics. + + This service uses the status file (see --status-file parameter). + + Perfdata contains the session / active / idle-in-transaction times + for each database since last call, as well as the number of sessions + per second, and the number of sessions killed / abandoned / + terminated by fatal errors. + + Required privileges: unprivileged role. + commit_ratio (all) Check the commit and rollback rate per second since last call. @@ -840,6 +860,12 @@ COMPATIBILITY to filter out pg_dump and pg_dumpall, set this to 'pg_dump,pg_dumpall'. + Before 9.2, this services checks for idle transaction with their + start time. Thus, the service can mistakenly take account of + transaction transiently in idle state. From 9.2 and up, the service + checks for transaction that really had no activity since the given + thresholds. + Required privileges: an unprivileged role checks only its own queries; a pg_monitor (10+) or superuser (<10) role is required to check all queries. @@ -1045,7 +1071,8 @@ COMPATIBILITY Perfdata returns the statistics snapshot age. - Critical and Warning thresholds accept a raw number of seconds. + Critical and Warning thresholds only accept an interval (eg. + 1h30m25s). Required privileges: unprivileged role. @@ -1268,7 +1295,7 @@ COMPATIBILITY check_pgactivity -p 5433 -h slave --service hit_ratio --dbinclude importantone -w 90% -c 80% VERSION - check_pgactivity version 2.5, released on Tue Nov 24 2020 + check_pgactivity version 2.6, released on Fri Jul 08 2022. LICENSING This program is open source, licensed under the PostgreSQL license. For diff --git a/README.pod b/README.pod index a73c597..5e506f1 100644 --- a/README.pod +++ b/README.pod @@ -118,10 +118,17 @@ It should be version 8.3 at least, but the server can be older. =item B<--status-file> PATH -Path to the file where service status information is kept between -successive calls. Default is to save check_pgactivity.data in the same +Path to the file where service status information is kept between successive +calls. Default is to save a file called C in the same directory as the script. +Note that this file is protected from concurrent writes using a lock file +located in the same directory, having the same name than the status file, but +with the extension C<.lock>. + +On some plateform, network filesystems may not be supported correctly by the +locking mechanism. See C for more information. + =item B<--dump-status-file> Dump the content of the status file and exit. This is useful for debugging @@ -467,6 +474,18 @@ provided that you grant SELECT on the system table pg_statistic to the pg_monitor role, in each database of the cluster: C +=item B (14+) + +Gather miscellaneous session statistics. + +This service uses the status file (see --status-file parameter). + +Perfdata contains the session / active / idle-in-transaction times +for each database since last call, as well as the number of sessions per second, +and the number of sessions killed / abandoned / terminated by fatal errors. + +Required privileges: unprivileged role. + =item B (all) Check the commit and rollback rate per second since last call. @@ -877,6 +896,12 @@ This service supports both C<--dbexclude> and C<--dbinclude> parameters. Above 9.2, it supports C<--exclude> to filter out connections. Eg., to filter out pg_dump and pg_dumpall, set this to 'pg_dump,pg_dumpall'. +Before 9.2, this services checks for idle transaction with their start time. +Thus, the service can mistakenly take account of transaction transiently in +idle state. +From 9.2 and up, the service checks for transaction that really had no activity +since the given thresholds. + Required privileges: an unprivileged role checks only its own queries; a pg_monitor (10+) or superuser (<10) role is required to check all queries. @@ -1078,7 +1103,7 @@ This probe helps to detect a frozen stats collector process. Perfdata returns the statistics snapshot age. -Critical and Warning thresholds accept a raw number of seconds. +Critical and Warning thresholds only accept an interval (eg. 1h30m25s). Required privileges: unprivileged role. @@ -1309,7 +1334,7 @@ pg_ls_waldir =head1 VERSION -check_pgactivity version 2.5, released on Tue Nov 24 2020 +check_pgactivity version 2.6, released on Fri Jul 08 2022. =head1 LICENSING diff --git a/RELEASING.md b/RELEASING.md index 2399843..ea4f47a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,10 +2,10 @@ ## Source code -Edit variable `$VERSION` in `check_pgactivity` - -Update the version field at -the end of the inline documentation in this script. +In `check_pgactivity`: + * edit variable `$VERSION` + * update the version and release date at the end of the inline documentation + * date format: `LC_TIME=C date +"%a %b %d %Y"` In `check_pgactivity.spec`: * update the tag in the `_tag` variable (first line) @@ -13,30 +13,49 @@ In `check_pgactivity.spec`: * edit the changelog * date format: `LC_TIME=C date +"%a %b %d %Y"` -## Run tests +In `CHANGELOG.md`, add a changelog entry for the new release with the format: -Run the tests against all possible PostgreSQL releases. At least the one -officially supported. Fix code or tests before releasing. +~~~ +YYYY-MM-DD vX.Y: + + * add: description... + * ... + * change: description... + * ... + * fix: description... + * ... +~~~ +In `t/01-pga_version.t`, edit variable `$good_version`. -## Documentation +Update documentation using the following commands: -Generate updated documentation: -``` +~~~ pod2text check_pgactivity > README podselect check_pgactivity > README.pod -``` +~~~ + +Update the `contributors` file with new contributors. + +## Run tests + +Run the tests against all possible PostgreSQL releases. At least the one +officially supported. Fix code or tests before releasing. + +## Commit + +Commit all these changes together with commit message: `Release X.Y`. ## Tagging and building tar file Directly into the official repo: -``` +~~~ TAG=REL2_4 git tag -a $TAG git push --tags git archive --prefix=check_pgactivity-$TAG/ -o /tmp/check_pgactivity-$TAG.tgz $TAG -``` +~~~ ## Release on github @@ -44,13 +63,14 @@ git archive --prefix=check_pgactivity-$TAG/ -o /tmp/check_pgactivity-$TAG.tgz $T - Edit the release notes for the new tag - Set "check_pgactivity $VERSION" as title, eg. "check_pgactivity 2.4" - Here is the format of the release node itself: + ~~~ YYYY-MM-DD - Version X.Y Changelog: * item 1 * item 2 * ... - + ~~~ - Upload the tar file - Save - Check or update https://github.com/OPMDG/check_pgactivity/releases @@ -59,21 +79,21 @@ git archive --prefix=check_pgactivity-$TAG/ -o /tmp/check_pgactivity-$TAG.tgz $T ### Installation -``` +~~~ yum group install "Development Tools" yum install rpmdevtools useradd makerpm -``` +~~~ ### Building the package -``` +~~~ su - makerpm rpmdev-setuptree git clone https://github.com/OPMDG/check_pgactivity.git spectool -R -g check_pgactivity/check_pgactivity.spec rpmbuild -ba check_pgactivity/check_pgactivity.spec -``` +~~~ The RPM is generated into `rpmbuild/RPMS/noarch`. diff --git a/check_pgactivity b/check_pgactivity index 2a129aa..b181492 100755 --- a/check_pgactivity +++ b/check_pgactivity @@ -64,7 +64,7 @@ delete $ENV{'LANGUAGE'}; $| = 1; -$VERSION = '2.5'; +$VERSION = '2.6'; $PROGRAM = 'check_pgactivity'; my $PG_VERSION_MIN = 70400; @@ -9265,7 +9265,7 @@ __END__ =head1 VERSION -check_pgactivity version 2.5, released on Tue Nov 24 2020 +check_pgactivity version 2.6, released on Fri Jul 08 2022. =head1 LICENSING diff --git a/check_pgactivity.spec b/check_pgactivity.spec index d1f9057..416f227 100644 --- a/check_pgactivity.spec +++ b/check_pgactivity.spec @@ -1,7 +1,7 @@ -%global _tag REL2_5 +%global _tag REL2_6 Name: nagios-plugins-pgactivity -Version: 2.5 +Version: 2.6 Release: 1 Summary: PostgreSQL monitoring plugin for Nagios License: PostgreSQL @@ -32,6 +32,9 @@ install -D -p -m 0755 check_pgactivity %{buildroot}/%{_libdir}/nagios/plugins/ch %doc README LICENSE %changelog +* Fri Jul 08 2022 Jehan-Guillaume de Rorthais 2.6-1 +- new major release 2.6 + * Tue Nov 24 2020 Jehan-Guillaume de Rorthais 2.5-1 - new major release 2.5 diff --git a/contributors b/contributors index 162d6f6..fbaca7d 100644 --- a/contributors +++ b/contributors @@ -17,6 +17,7 @@ The following contributors helped to bring check_pgactivity : * Andrey L. (loukash) * macarbiter * Frédéric Yhuel + * Julian Vanden Broeck And many users that reported issues. Thanks to all ! diff --git a/t/01-pga_version.t b/t/01-pga_version.t index 95f4ac3..36906e4 100644 --- a/t/01-pga_version.t +++ b/t/01-pga_version.t @@ -13,7 +13,7 @@ use Test::More tests => 18; ### Begin of tests ### -my $good_version = '2.5'; +my $good_version = '2.6'; my $bad_version = '0.0'; my $not_version = 'whatever';