Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
titlenrpe.cfg
vi /usr/local/nagios/etc/nrpe.cfg
...
command[check_pg_connection]=/usr/local/nagios/libexec/check_postgres.pl -H localhost -db template1 -u nagios --action connection
command[check_pg_dbstats]=/usr/local/nagios/libexec/check_postgres.pl -H localhost -db template1 -u nagios --action dbstats
command[check_pg_bloat]=/usr/local/nagios/libexec/check_postgres.pl -H localhost -db template1 -u nagios --action bloat
# in the next line, you should set the limits as appropriate
command[check_pg_database_size]=/usr/local/nagios/libexec/check_postgres.pl -H localhost -db template1 -u nagios  --action database_size --warning='30 GB' --critical='35 GB'

Test on Nagios server

Replace the "yourserver.yourdomain.tld" with the IP address or IP name of your MySQL server:

/usr/local/nagios/libexec/check_nrpe -H yourserver.yourdomain.tld -c check_pg_connection

If the system returns "ERROR: Could not find a suitable psql executable", your Postgres installation may not use the default location. Normally this should be solved by setting the environment variable "PGBINDIR" to the path to psql, and adding this path to the PATH variable (e.g. in /etc/profile.d/), but for some reasons this doesn't work. You have to modify "check_postgres.pl"

Code Block
languagebash
vi /usr/local/nagios/libexec/check_postgres.pl
... locate the line starting with "$PGBINDIR ="
... and replace it with
$PGBINDIR = '/usr/local/pgsql/bin';
... or wherever your psql binary is installed.