The check_pgsql Plugin

check_pgsql v2.3git (monitoring-plugins 2.3git)
Copyright (c) 1999-2011 Monitoring Plugins Development Team

Test whether a PostgreSQL Database is accepting connections.

check_pgsql [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]
 [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]
[-q <query>] [-C <critical query range>] [-W <warning query range>]

 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
    Read options from an ini file. See
    for usage and examples.
 -H, --hostname=ADDRESS
    Host name, IP Address, or unix socket (must be an absolute path)
 -P, --port=INTEGER
    Port number (default: 5432)
 -d, --database=STRING
    Database to check (default: template1)
 -l, --logname = STRING
    Login name of user
 -p, --password = STRING
 -o, --option = STRING
    Connection parameters (keyword = value), see below
 -w, --warning=DOUBLE
    Response time to result in warning status (seconds)
 -c, --critical=DOUBLE
    Response time to result in critical status (seconds)
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 10)
 -q, --query=STRING
    SQL query to run. Only first column in first row will be read
    A name for the query, this string is used instead of the query
    in the long output of the plugin
 -W, --query-warning=RANGE
    SQL query value to result in warning status (double)
 -C, --query-critical=RANGE
    SQL query value to result in critical status (double)
 -v, --verbose
    Show details for command-line debugging (output may be truncated by
    the monitoring system)

 All parameters are optional.
 This plugin tests a PostgreSQL DBMS to determine whether it is active and
 accepting queries. In its current operation, it simply connects to the
 specified database, and then disconnects. If no database is specified, it
 connects to the template1 database, which is present in every functioning
 PostgreSQL DBMS.

 If a query is specified using the -q option, it will be executed after
 connecting to the server. The result from the query has to be numeric.
 Multiple SQL commands, separated by semicolon, are allowed but the result 
 of the last command is taken into account only. The value of the first
 column in the first row is used as the check result.

 See the chapter "Monitoring Database Activity" of the PostgreSQL manual
 for details about how to access internal statistics of the database server.

 For a list of available connection parameters which may be used with the -o
 command line option, see the documentation for PQconnectdb() in the chapter
 "libpq - C Library" of the PostgreSQL manual. For example, this may be
 used to specify a service name in pg_service.conf to be used for additional
 connection parameters: -o 'service=<name>' or to specify the SSL mode:
 -o 'sslmode=require'.

 The plugin will connect to a local postmaster if no host is specified. To
 connect to a remote host, be sure that the remote postmaster accepts TCP/IP
 connections (start the postmaster with the -i option).

 Typically, the monitoring user (unless the --logname option is used) should be
 able to connect to the database without a password. The plugin can also send
 a password, but no effort is made to obscure or encrypt the password.

Send email to if you have questions regarding
use of this software. To submit patches or suggest improvements, send email