MRTG output

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_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

Some actions accept an optional –mrtg argument to further control the output.

See the documentation on each action for details on the exact MRTG output for each one.

Simple output

The simple output is simply a truncated version of the MRTG one, and simply returns the first number
and nothing else. This is very useful when you just want to check the state of something, regardless
of any threshold.


All actions accept a common set of database options. At least one is required.

-H NAME or –host=NAME

Connect to the host indicated by NAME. Can be a comma-separated list of names. Multiple host arguments
are allowed. If no host is given, defaults to a local Unix socket. You may also use "–dbhost".

-p PORT or –port=PORT

Connects using the specified PORT number. Can be a comma-separated list of port numbers, and multiple
port arguments are allowed. If no port number is given, the default is 5432. You may also use "–dbport"

-db NAME or –dbname=NAME

Specifies which database to connect to. Can be a comma-separated list of names, and multiple dbname
arguments are allowed. If no dbname option is provided, defaults to ‘postgres’ if psql
is version 8 or greater, and ‘template1’ otherwise.


The name of the database user to connect as. Can be a comma-separated list of usernames, and multiple
dbuser arguments are allowed. If this is not provided, the default is ‘postgres’.


Provides the password to connect to the database with. Use of this option is highly discouraged.
Instead, one should use a .pgpass file.

The database connection options can be grouped: –host=a,b –host=c –port=1234 –port=3344
would connect to a-1234, b-1234, and c-3344. Note that once set, an option
carries over until it is changed again.



  1. --host=a,b --port=5433 --db=c
  2.   Connects twice to port 5433, using database c, to hosts a and b: a-5433-c b-5433-c

  1. --host=a,b --port=5433 --db=c,d
  2.   Connects four times: a-5433-c a-5433-d b-5433-c b-5433-d

  1. --host=a,b --host=foo --port=1234 --port=5433 --db=e,f
  2.   Connects six times: a-1234-e a-1234-f b-1234-e b-1234-f foo-5433-e foo-5433-f

  1. --host=a,b --host=x --port=5432,5433 --dbuser=alice --dbuser=bob -db=baz
  2.   Connects three times: a-5432-alice-baz b-5433-alice-baz x-5433-bob-baz


Other options include:


States what action we are running. Required unless using a symlinked file,
in which case the name of the file is used to figure out the action.

–warning=VAL or -w VAL

Sets the threshold at which a warning alert is fired. The valid options for this
option depends on the action used.

–critical=VAL or -c VAL

Leave a Reply

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

clear formPost comment