Skip to content

Commit 0644e96

Browse files
author
Greg Sabino Mullane
committed
Fix order of documentation per bug bucardo#60.
Add a new test to check on internal documentation.
1 parent 3133727 commit 0644e96

File tree

2 files changed

+188
-101
lines changed

2 files changed

+188
-101
lines changed

check_postgres.pl

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ sub finishup {
14781478
check_fsm_relations() if $action eq 'fsm_relations';
14791479

14801480
## Spit back info from the pg_stat_database table. Cacti only
1481-
show_dbstats() if $action eq 'dbstats';
1481+
check_dbstats() if $action eq 'dbstats';
14821482

14831483
## Check how long since the last checkpoint
14841484
check_checkpoint() if $action eq 'checkpoint';
@@ -3263,7 +3263,7 @@ sub check_database_size {
32633263
} ## end of check_database_size
32643264

32653265

3266-
sub show_dbstats {
3266+
sub check_dbstats {
32673267

32683268
## Returns values from the pg_stat_database view
32693269
## Supports: Cacti
@@ -3328,7 +3328,7 @@ sub show_dbstats {
33283328

33293329
exit 0;
33303330

3331-
} ## end of show_dbstats
3331+
} ## end of check_dbstats
33323332

33333333

33343334
sub check_disabled_triggers {
@@ -4143,7 +4143,7 @@ sub check_logfile {
41434143
} ## end of check_logfile
41444144

41454145

4146-
sub check_new_version {
4146+
sub find_new_version {
41474147

41484148
## Check for newer versions of some program
41494149

@@ -4250,15 +4250,15 @@ sub check_new_version {
42504250
add_unknown msg('new-ver-tt', $program, $lversion, $cversion);
42514251
return;
42524252

4253-
} ## end of check_new_version
4253+
} ## end of find_new_version
42544254

42554255

42564256
sub check_new_version_bc {
42574257

42584258
## Check if a newer version of Bucardo is available
42594259

42604260
my $url = 'http://bucardo.org/bucardo/latest_version.txt';
4261-
check_new_version('Bucardo', 'bucardo_ctl', $url);
4261+
find_new_version('Bucardo', 'bucardo_ctl', $url);
42624262

42634263
return;
42644264

@@ -4270,7 +4270,7 @@ sub check_new_version_cp {
42704270
## Check if a new version of check_postgres.pl is available
42714271

42724272
my $url = 'http://bucardo.org/check_postgres/latest_version.txt';
4273-
check_new_version('check_postgres', $VERSION, $url);
4273+
find_new_version('check_postgres', $VERSION, $url);
42744274

42754275
return;
42764276

@@ -4296,7 +4296,7 @@ sub check_new_version_pg {
42964296
return;
42974297
}
42984298

4299-
check_new_version('Postgres', $lversion, $url);
4299+
find_new_version('Postgres', $lversion, $url);
43004300

43014301
return;
43024302

@@ -4308,14 +4308,14 @@ sub check_new_version_tnm {
43084308
## Check if a new version of tail_n_mail is available
43094309

43104310
my $url = 'http://bucardo.org/tail_n_mail/latest_version.txt';
4311-
check_new_version('tail_n_mail', 'tail_n_mail', $url);
4311+
find_new_version('tail_n_mail', 'tail_n_mail', $url);
43124312

43134313
return;
43144314

43154315
} ## end of check_new_version_tnm
43164316

43174317

4318-
sub check_pg_stat_activity {
4318+
sub find_pg_stat_activity {
43194319

43204320
## Common function to run various actions against the pg_stat_activity view
43214321
## Actions: txn_idle, txn_time, query_time
@@ -4462,7 +4462,7 @@ sub check_pg_stat_activity {
44624462

44634463
return;
44644464

4465-
} ## end of check_pg_stat_activity
4465+
} ## end of find_pg_stat_activity
44664466

44674467

44684468
sub check_pgbouncer_checksum {
@@ -4526,7 +4526,9 @@ sub check_pgbouncer_checksum {
45264526

45274527
} ## end of check_pgbouncer_checksum
45284528

4529+
45294530
sub check_pgb_pool {
4531+
45304532
# Check various bits of the pgbouncer SHOW POOLS ouptut
45314533
my $stat = shift;
45324534
my ($warning, $critical) = validate_range({type => 'positive integer'});
@@ -4560,6 +4562,7 @@ sub check_pgb_pool {
45604562

45614563
} ## end of check_pgb_pool
45624564

4565+
45634566
sub check_prepared_txns {
45644567

45654568
## Checks age of prepared transactions
@@ -4704,7 +4707,7 @@ sub check_query_time {
47044707

47054708
## Check the length of running queries
47064709

4707-
return check_pg_stat_activity(
4710+
return find_pg_stat_activity(
47084711
{
47094712
default_warning => '2 minutes',
47104713
default_critical => '5 minutes',
@@ -7936,16 +7939,16 @@ =head2 B<relation_size>
79367939
For MRTG output, returns the size in bytes of the largest relation, and the name of the database
79377940
and relation as the fourth line.
79387941
7939-
=head2 B<last_vacuum>
7940-
7941-
=head2 B<last_autovacuum>
7942-
79437942
=head2 B<last_analyze>
79447943
7944+
=head2 B<last_vacuum>
7945+
79457946
=head2 B<last_autoanalyze>
79467947
7947-
(symlinks: C<check_postgres_last_vacuum>, C<check_postgres_last_autovacuum>, C<check_postgres_last_analyze>, and
7948-
C<check_postgres_last_autoanalyze>)
7948+
=head2 B<last_autovacuum>
7949+
7950+
(symlinks: C<check_postgres_last_analyze>, C<check_postgres_last_vacuum>,
7951+
C<check_postgres_last_autoanalyze>, and C<check_postgres_last_autovacuum>)
79497952
Checks how long it has been since vacuum (or analyze) was last run on each
79507953
table in one or more databases. Use of these actions requires that the target
79517954
database is version 8.3 or greater, or that the version is 8.2 and the
@@ -8361,6 +8364,30 @@ =head2 B<sequence>
83618364
83628365
check_postgres_sequence --dbport=5432 --critical=50% --include=orders_id_seq
83638366
8367+
=head2 B<settings_checksum>
8368+
8369+
(C<symlink: check_postgres_settings_checksum>) Checks that all the Postgres settings are the same as last time you checked.
8370+
This is done by generating a checksum of a sorted list of setting names and
8371+
their values. Note that different users in the same database may have different
8372+
checksums, due to ALTER USER usage, and due to the fact that superusers see more
8373+
settings than ordinary users. Either the I<--warning> or the I<--critical> option
8374+
should be given, but not both. The value of each one is the checksum, a
8375+
32-character hexadecimal value. You can run with the special C<--critical=0> option
8376+
to find out an existing checksum.
8377+
8378+
This action requires the Digest::MD5 module.
8379+
8380+
Example 1: Find the initial checksum for the database on port 5555 using the default user (usually postgres)
8381+
8382+
check_postgres_settings_checksum --port=5555 --critical=0
8383+
8384+
Example 2: Make sure no settings have changed and warn if so, using the checksum from above.
8385+
8386+
check_postgres_settings_checksum --port=5555 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231
8387+
8388+
For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A
8389+
checksum must be provided as the C<--mrtg> argument. The fourth line always gives the
8390+
current checksum.
83648391
83658392
=head2 B<slony_status>
83668393
@@ -8380,35 +8407,22 @@ =head2 B<slony_status>
83808407
83818408
check_postgres_slony_status --schema=_slony --critical=600
83828409
8410+
=head2 B<timesync>
83838411
8384-
=head2 B<txn_time>
8385-
8386-
8387-
(C<symlink: check_postgres_txn_time>) Checks the length of open transactions on one or more databases.
8388-
There is no need to run this command more than once per database cluster.
8389-
Databases can be filtered by use of the
8390-
I<--include> and I<--exclude> options. See the L</"BASIC FILTERING"> section
8391-
for more details. The owner of the transaction can also be filtered, by use of
8392-
the I<--includeuser> and I<--excludeuser> options.
8393-
See the L</"USER NAME FILTERING"> section for more details.
8394-
8395-
The values or the I<--warning> and I<--critical> options are units of time, and
8396-
must be provided (no default). Valid units are 'seconds', 'minutes', 'hours',
8397-
or 'days'. Each may be written singular or abbreviated to just the first letter.
8398-
If no units are given, the units are assumed to be seconds.
8399-
8400-
This action requires Postgres 8.3 or better.
8401-
8402-
Example 1: Give a critical if any transaction has been open for more than 10 minutes:
8412+
(C<symlink: check_postgres_timesync>) Compares the local system time with the time reported by one or more databases.
8413+
The I<--warning> and I<--critical> options represent the number of seconds between
8414+
the two systems before an alert is given. If neither is specified, the default values
8415+
are used, which are '2' and '5'. The warning value cannot be greater than the critical
8416+
value. Due to the non-exact nature of this test, values of '0' or '1' are not recommended.
84038417
8404-
check_postgres_txn_time --port=5432 --critical='10 minutes'
8418+
The string returned shows the time difference as well as the time on each side written out.
84058419
8406-
Example 1: Warn if user 'warehouse' has a transaction open over 30 seconds
8420+
Example 1: Check that databases on hosts ankh, morpork, and klatch are no more than 3 seconds off from the local time:
84078421
8408-
check_postgres_txn_time --port-5432 --warning=30s --includeuser=warehouse
8422+
check_postgres_timesync --host=ankh,morpork,klatch --critical=3
84098423
8410-
For MRTG output, returns the maximum time in seconds a transaction has been open on the
8411-
first line. The fourth line gives the name of the database.
8424+
For MRTG output, returns one the first line the number of seconds difference between the local
8425+
time and the database time. The fourth line returns the name of the database.
84128426
84138427
=head2 B<txn_idle>
84148428
@@ -8432,58 +8446,33 @@ =head2 B<txn_idle>
84328446
For MRTG output, returns the time in seconds the longest idle transaction has been running. The fourth
84338447
line returns the name of the database.
84348448
8435-
=head2 B<rebuild_symlinks>
8436-
8437-
=head2 B<rebuild_symlinks_force>
8438-
8439-
This action requires no other arguments, and does not connect to any databases,
8440-
but simply creates symlinks in the current directory for each action, in the form
8441-
B<check_postgres_E<lt>action_nameE<gt>>.
8442-
If the file already exists, it will not be overwritten. If the action is rebuild_symlinks_force,
8443-
then symlinks will be overwritten. The option --symlinks is a shorter way of saying
8444-
--action=rebuild_symlinks
8445-
8446-
=head2 B<settings_checksum>
8447-
8448-
(C<symlink: check_postgres_settings_checksum>) Checks that all the Postgres settings are the same as last time you checked.
8449-
This is done by generating a checksum of a sorted list of setting names and
8450-
their values. Note that different users in the same database may have different
8451-
checksums, due to ALTER USER usage, and due to the fact that superusers see more
8452-
settings than ordinary users. Either the I<--warning> or the I<--critical> option
8453-
should be given, but not both. The value of each one is the checksum, a
8454-
32-character hexadecimal value. You can run with the special C<--critical=0> option
8455-
to find out an existing checksum.
8456-
8457-
This action requires the Digest::MD5 module.
8458-
8459-
Example 1: Find the initial checksum for the database on port 5555 using the default user (usually postgres)
8460-
8461-
check_postgres_settings_checksum --port=5555 --critical=0
8462-
8463-
Example 2: Make sure no settings have changed and warn if so, using the checksum from above.
8449+
=head2 B<txn_time>
84648450
8465-
check_postgres_settings_checksum --port=5555 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231
8451+
(C<symlink: check_postgres_txn_time>) Checks the length of open transactions on one or more databases.
8452+
There is no need to run this command more than once per database cluster.
8453+
Databases can be filtered by use of the
8454+
I<--include> and I<--exclude> options. See the L</"BASIC FILTERING"> section
8455+
for more details. The owner of the transaction can also be filtered, by use of
8456+
the I<--includeuser> and I<--excludeuser> options.
8457+
See the L</"USER NAME FILTERING"> section for more details.
84668458
8467-
For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A
8468-
checksum must be provided as the C<--mrtg> argument. The fourth line always gives the
8469-
current checksum.
8459+
The values or the I<--warning> and I<--critical> options are units of time, and
8460+
must be provided (no default). Valid units are 'seconds', 'minutes', 'hours',
8461+
or 'days'. Each may be written singular or abbreviated to just the first letter.
8462+
If no units are given, the units are assumed to be seconds.
84708463
8471-
=head2 B<timesync>
8464+
This action requires Postgres 8.3 or better.
84728465
8473-
(C<symlink: check_postgres_timesync>) Compares the local system time with the time reported by one or more databases.
8474-
The I<--warning> and I<--critical> options represent the number of seconds between
8475-
the two systems before an alert is given. If neither is specified, the default values
8476-
are used, which are '2' and '5'. The warning value cannot be greater than the critical
8477-
value. Due to the non-exact nature of this test, values of '0' or '1' are not recommended.
8466+
Example 1: Give a critical if any transaction has been open for more than 10 minutes:
84788467
8479-
The string returned shows the time difference as well as the time on each side written out.
8468+
check_postgres_txn_time --port=5432 --critical='10 minutes'
84808469
8481-
Example 1: Check that databases on hosts ankh, morpork, and klatch are no more than 3 seconds off from the local time:
8470+
Example 1: Warn if user 'warehouse' has a transaction open over 30 seconds
84828471
8483-
check_postgres_timesync --host=ankh,morpork,klatch --critical=3
8472+
check_postgres_txn_time --port-5432 --warning=30s --includeuser=warehouse
84848473
8485-
For MRTG output, returns one the first line the number of seconds difference between the local
8486-
time and the database time. The fourth line returns the name of the database.
8474+
For MRTG output, returns the maximum time in seconds a transaction has been open on the
8475+
first line. The fourth line gives the name of the database.
84878476
84888477
=head2 B<txn_wraparound>
84898478
@@ -8507,6 +8496,24 @@ =head2 B<txn_wraparound>
85078496
For MRTG output, returns the highest number of transactions for all databases on line one,
85088497
while line 4 indicates which database it is.
85098498
8499+
=head2 B<version>
8500+
8501+
(C<symlink: check_postgres_version>) Checks that the required version of Postgres is running. The
8502+
I<--warning> and I<--critical> options (only one is required) must be of
8503+
the format B<X.Y> or B<X.Y.Z> where B<X> is the major version number,
8504+
B<Y> is the minor version number, and B<Z> is the revision.
8505+
8506+
Example 1: Give a warning if the database on port 5678 is not version 8.4.10:
8507+
8508+
check_postgres_version --port=5678 -w=8.4.10
8509+
8510+
Example 2: Give a warning if any databases on hosts valley,grain, or sunshine is not 8.3:
8511+
8512+
check_postgres_version -H valley,grain,sunshine --critical=8.3
8513+
8514+
For MRTG output, reports a 1 or a 0 indicating success or failure on the first line. The
8515+
fourth line indicates the current version. The version must be provided via the C<--mrtg> option.
8516+
85108517
=head2 B<wal_files>
85118518
85128519
(C<symlink: check_postgres_wal_files>) Checks how many WAL files exist in the F<pg_xlog> directory, which is found
@@ -8549,23 +8556,16 @@ =head2 B<archive_ready>
85498556
85508557
For MRTG output, reports the number of ready WAL files on line 1.
85518558
8552-
=head2 B<version>
8553-
8554-
(C<symlink: check_postgres_version>) Checks that the required version of Postgres is running. The
8555-
I<--warning> and I<--critical> options (only one is required) must be of
8556-
the format B<X.Y> or B<X.Y.Z> where B<X> is the major version number,
8557-
B<Y> is the minor version number, and B<Z> is the revision.
8558-
8559-
Example 1: Give a warning if the database on port 5678 is not version 8.4.10:
8560-
8561-
check_postgres_version --port=5678 -w=8.4.10
8562-
8563-
Example 2: Give a warning if any databases on hosts valley,grain, or sunshine is not 8.3:
8559+
=head2 B<rebuild_symlinks>
85648560
8565-
check_postgres_version -H valley,grain,sunshine --critical=8.3
8561+
=head2 B<rebuild_symlinks_force>
85668562
8567-
For MRTG output, reports a 1 or a 0 indicating success or failure on the first line. The
8568-
fourth line indicates the current version. The version must be provided via the C<--mrtg> option.
8563+
This action requires no other arguments, and does not connect to any databases,
8564+
but simply creates symlinks in the current directory for each action, in the form
8565+
B<check_postgres_E<lt>action_nameE<gt>>.
8566+
If the file already exists, it will not be overwritten. If the action is rebuild_symlinks_force,
8567+
then symlinks will be overwritten. The option --symlinks is a shorter way of saying
8568+
--action=rebuild_symlinks
85698569
85708570
=head1 BASIC FILTERING
85718571

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy