Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions check_pgactivity
Original file line number Diff line number Diff line change
Expand Up @@ -8653,28 +8653,26 @@ sub check_table_unlogged {

Check relations' size.

Without C<--critical> or C<--warning> parameters, this service attempts to
fetch all relations' size.

An alert is raised if an relation's size is above the warning or critical level.
Critical and Warning thresholds are optional. An alert is raised if a
relation's size is above the warning or critical level. They only accept a
raw number or a size.

This service supports both C<--dbexclude> and C<--dbinclude> parameters.
The 'postgres' database and templates are always excluded.
This service supports both C<--dbexclude> and C<--dbinclude> parameters.
The "postgres" database and templates are always excluded.

This service supports a C<--exclude REGEX> parameter to exclude relations
This service supports a C<--exclude REGEX> parameter to exclude relations
matching a regular expression. The regular expression applies to
"database.schema_name.relation_name". This enables you to filter either on a
relation name for all schemas and databases, on a qualified named relation
(schema + relation) for all databases or on a qualified named relation in
only one database.

You can use multiple C<--exclude REGEX> parameters.

Perfdata will return the number of relations per database.
You can use multiple C<--exclude REGEX> parameters.

A list of the relations and their sizes will be returned after the
perfdata. This list contains the fully qualified relation name. If
C<--exclude REGEX> is set, the number of excluded relations is returned.
Perfdata returns the size of all relations per database. This list use the
fully qualified name of each relation. If C<--exclude REGEX> is set, the
number of excluded relations is returned in the long text field of the
plugin.

Required privileges: unprivileged role able to log in all databases,
or at least those in C<--dbinclude>.
Expand Down Expand Up @@ -8715,6 +8713,13 @@ sub check_relation_size {

is_compat $hosts[0], 'relation_size', $PG_VERSION_90 or exit 1;

pod2usage(
-message => "FATAL: Warning and critical args only accept a raw number or a size.\n"
. "See documentation for more information.",
-exitval => 127
) if (defined $args{'warning'} and not is_size($args{'warning'}))
or (defined $args{'critical'} and not is_size($args{'critical'}));

@all_db = @{ get_all_dbname( $hosts[0] ) };

# Iterate over all db
Expand Down