NAME

check_postgres.pl – a Postgres monitoring script for Nagios, MRTG, and others
This documents describes check_postgres.pl version 2.3.7


SYNOPSIS

bash

  1. ## Create all symlinks
  2.   check_postgres.pl --symlinks
bash

  1. ## Check connection to Postgres database 'pluto':
  2.   check_postgres.pl --action=connection --db=pluto
bash

  1. ## Same things, but using the symlink
  2.   check_postgres_connection --db=pluto
bash

  1. ## Warn if > 100 locks, critical if > 200, or > 20 exclusive
  2.   check_postgres_locks --warning=100 --critical="total=200;exclusive=20"
bash

  1. ## Show the current number of idle connections on port 6543:
  2.   check_postgres_txn_idle --port=6543 --output=simple
bash

  1. ## There are many other actions and options, please keep reading.
bash

  1. The latest news and documentation can always be found at:
  2.   <a href="http://bucardo.org/check_postgres/">http://bucardo.org/check_postgres/</a>


DESCRIPTION

check_postgres.pl is a Perl script that runs many different tests against
one or more Postgres databases. It uses the psql program to gather the
information, and outputs the results in one of three formats: Nagios, MRTG,
or simple.

Output Modes

The output can be changed by use of the --output option. The default output
is nagios, although this can be changed at the top of the script if you wish. The
current option choices are nagios, mrtg, and simple. To avoid having to
enter the output argument each time, the type of output is automatically set
if no –output argument is given, and if the current directory has one of the
output options in its name. For example, creating a directory named mrtg and
populating it with symlinks via the –symlinks argument would ensure that
any actions run from that directory will always default to an output of "mrtg"
As a shortcut for –output=simple, you can enter –simple, which also overrides
the directory naming trick.

Nagios output

The default output format is for Nagios, which is a single line of information, along
with four specific exit codes:

  1. (OK)
  2. (WARNING)
  3. (CRITICAL)
  4. (UNKNOWN)

The output line is one of the words above, a colon, and then a short description of what
was measured. Additional statistics information, as well as the total time the command
took, can be output as well: see the documentation on the arguments
–showperf,
–perflimit, and
–showtime.

Leave a Reply

Your email address will not be published. Required fields are marked *

clear formPost comment