From: Greg Sabino Mullane check_postgres.pl - a Postgres monitoring script for Nagios, MRTG, and others
-This documents describes check_postgres.pl version 2.2.4
NAME
The MRTG output is four lines, with the first line always giving a single number of importance. When possible, this number represents an actual value such as a number of bytes, but it -may also be a 1 or a 0 for actions that only return "true" or "false", such as check_version. +may also be a 1 or a 0 for actions that only return "true" or "false", such as check_postgres_version. The second line is an additional stat and is only used for some actions. The third line indicates an "uptime" and is not used. The fourth line is a description and usually indicates the name of the database the stat from the first line was pulled from, but may be different depending on the @@ -665,10 +666,10 @@ it contains are small and do not change.
Example 1: Warn if any table has not been vacuumed in 3 days, and give a critical at a week, for host wormwood
- check_last_vacuum --host=wormwood --warning='3d' --critical='7d'+ check_postgres_last_vacuum --host=wormwood --warning='3d' --critical='7d'
Example 2: Same as above, but skip tables belonging to the users 'eve' or 'mallory'
- check_last_vacuum --host=wormwood --warning='3d' --critical='7d' --excludeusers=eve,mallory+ check_postgres_last_vacuum --host=wormwood --warning='3d' --critical='7d' --excludeusers=eve,mallory
For MRTG output, returns (on the first line) the LEAST amount of time in seconds since a table was last vacuumed or analyzed. The fourth line returns the name of the database and name of the table.
@@ -772,6 +773,27 @@ assumed to be seconds.
line gives the name of the database.+
(symlink: check_postgres_sequence) Checks how much room is left on all sequences in the database.
+This is measured as the percent of total possible values that have been used for each sequence.
+The --warning and --critical options should be expressed as percentages. The default values
+are 85% for the warning and 95% for the critical. You may use --include and --exclude to
+control which sequences are to be checked. Note that this check does account for unusual minvalue
+and increment by values, but does not care if the sequence is set to cycle or not.
The output for Nagios gives the name of the sequence, the percentage used, and the number of 'calls' +left, indicating how many more times nextval can be called on that sequence before running into +the maximum value.
+The output for MRTG returns the highest percentage across all sequences on the first line, and +the name of each sequence with that percentage on the fourth line, separated by a "|" (pipe) +if there are more than one sequence at that percentage.
+Example 1: Give a warning if any sequences are approaching 95% full.
++ check_postgres_sequence --dbport=5432 --warning=95%+
Example 2: Check that the sequence named "orders_id_seq" is not more than half full.
++ check_postgres_sequence --dbport=5432 --critical=50% --include=orders_id_seq+
+
(symlink: check_postgres_replicate_row) Checks that master-slave replication is working to one or more slaves.
The slaves are specified the same as the normal databases, except with
@@ -936,7 +958,7 @@ out of space, at which point Postgres will shut down.
(symlink: check_version) Checks that the required version of Postgres is running. The
+
(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.
Items not specifically attributed are by Greg Sabino Mullane.
+ Add the "sequence" action, thanks to Gavin M. Roy for the idea. + Fix minor problem with autovac_freeze action when using MRTG output. + Allow output argument to be case-insensitive. + Documentation fixes.+
- Allow check_bloat to work on Postgres version 8.0. + Allow 'bloat' action to work on Postgres version 8.0. Allow for different commands to be run for each action depending on the server version. Give better warnings when running actions not available on older Postgres servers.
- Have check_wal_files use pg_ls_dir (idea by Robert Treat).
+ Have 'wal_files' action use pg_ls_dir (idea by Robert Treat).
For last_vacuum and last_analyze, respect autovacuum effects, add separate
autovacuum checks (ideas by Robert Treat).
@@ -1320,11 +1351,11 @@ feature requests, and commit notices, send email to End Point Corporation and is BSD-licensed. The latest version is 2.2.4, and was released on October 03, 2008.
+check_postgres.pl is a script for checking the state of one or more Postgres databases and reporting back in a Nagios-friendly manner. It was developed by Greg Sabino Mullane of End Point Corporation and is BSD-licensed. The latest version is 2.3.0, and was released on October 04, 2008.
The latest development version can be downloaded via git: