symlink: check_postgres_txn_idle) Checks the length of "idle in transaction" queries on one or more databases. There is
no need to run this more than once on the same database cluster. Databases can be filtered
by using the –include and –exclude options. See the BASIC FILTERING
section below for more details.
The –warning and –critical options are given as units of time, and both must
be provided (there are no defaults). Valid units are ‘seconds’, ‘minutes’, ‘hours’,
or ‘days’. Each may be written singular or abbreviated to just the first letter.
If no units are given, the unit are assumed to be seconds.
This action requires Postgres 8.3 or better.
Example 1: Give a warning if any connection has been idle in transaction for more than 15 seconds:
- check_postgres_txn_idle --port=5432 --warning='15 seconds'
For MRTG output, returns the time in seconds the longest idle transaction has been running. The fourth
line returns the name of the database.
This action requires no other arguments, and does not connect to any databases,
but simply creates symlinks in the current directory for each action, in the form
If the file already exists, it will not be overwritten. If the action is rebuild_symlinks_force,
then symlinks will be overwritten. The option –symlinks is a shorter way of saying
symlink: check_postgres_settings_checksum) Checks that all the Postgres settings are the same as last time you checked.
This is done by generating a checksum of a sorted list of setting names and
their values. Note that different users in the same database may have different
checksums, due to ALTER USER usage, and due to the fact that superusers see more
settings than ordinary users. Either the –warning or the –critical option
should be given, but not both. The value of each one is the checksum, a
32-character hexadecimal value. You can run with the special
to find out an existing checksum.
This action requires the Digest::MD5 module.
Example 1: Find the initial checksum for the database on port 5555 using the default user (usually postgres)
- check_postgres_settings_checksum --port=5555 --critical=0
Example 2: Make sure no settings have changed and warn if so, using the checksum from above.
- check_postgres_settings_checksum --port=5555 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231
For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A
checksum must be provided as the
--mrtg argument. The fourth line always gives the
symlink: check_postgres_timesync) Compares the local system time with the time reported by one or more databases.
The –warning and –critical options represent the number of seconds between
the two systems before an alert is given. If neither is specified, the default values
are used, which are ‘2’ and ‘5’. The warning value cannot be greater than the critical
value. Due to the non-exact nature of this test, values of ‘0’ or ‘1’ are not recommended.
The string returned shows the time difference as well as the time on each side written out.
Example 1: Check that databases on hosts ankh, morpork, and klatch are no more than 3 seconds off from the local time:
- check_postgres_timesync --host=ankh,morpork.klatch --critical=3
For MRTG output, returns one the first line the number of seconds difference between the local
time and the database time. The fourth line returns the name of the database.
symlink: check_postgres_txn_wraparound) Checks how close to transaction wraparound one or more databases are getting.
The –warning and –critical options indicate the number of transactions
left, and must be a positive integer. If either option is not given, the default
values of 1.3 and 1.4 billion are used. There is no need to run this command
more than once per database cluster. For a more detailed discussion of what this
number represents and what to do about it, please visit the page
The warning and value can have underscores in the number for legibility, as Perl does.
Example 1: Check the default values for the localhost database
- check_postgres_txn_wraparound --host=localhost
Example 2: Check port 6000 and give a critical at 1.7 billion transactions left:
- check_postgres_txn_wraparound --port=6000 --critical=1_700_000_000t
For MRTG output, returns the highest number of transactions for all databases on line one,
while line 4 indicates which database it is.
symlink: check_postgres_wal_files) Checks how many WAL files exist in the pg_xlog directory, which is found
off of your data_directory, sometimes as a symlink to another physical disk for
performance reasons. This action must be run as a superuser, in order to access the
contents of the pg_xlog directory. The minimum version to use this action is
Postgres 8.1. The –warning and –critical options are simply the number of
files in the pg_xlog directory. What number to set this to will vary, but a general
guideline is to put a number slightly higher than what is normally there, to catch
Normally, WAL files are closed and then re-used, but a long-running open
transaction, or a faulty archive_command script, may cause Postgres to
create too many files. Ultimately, this will cause the disk they are on to run
out of space, at which point Postgres will shut down.
Example 1: Check that the number of WAL files is 20 or less on host "pluto"
- check_postgres_txn_wraparound --host=pluto --critical=20
For MRTG output, reports the number of WAL files on line 1.
symlink: check_postgres_version) Checks that the required version of Postgres is running. The
–warning and –critical options (only one is required) must be of
the format X.Y or X.Y.Z where X is the major version number,
Y is the minor version number, and Z is the revision.
Example 1: Give a warning if the database on port 5678 is not version 8.4.10:
- check_postgres_version --port=5678 -w=8.4.10
Example 2: Give a warning if any databases on hosts valley,grain, or sunshine is not 8.3:
- check_postgres_version -H valley,grain,sunshine --critical=8.3
For MRTG output, reports a 1 or a 0 indicating success or failure on the first line. The
fourth line indicates the current version. The version must be provided via the