Check pgsql - NRPE PostgreSQL check
From TykWiki
By default NRPE includes a plugin to check a PostgreSQL server. Follow the instructions on this page to enable it.
Configuring Nagios
Define a new service on the Nagios server, in /usr/local/etc/nagios/objects/services.cfg:
define service{
use generic-service
hostgroup_name postgresql-servers
service_description nrpe_check_pgsql
check_command check_nrpe2!check_pgsql
}
The FreeBSD servers I monitor that has PostgreSQL installed are all members of the hostgroup postgresql-servers.
Configuring NRPE
Add the following line to /usr/local/etc/nrpe.cfg:
command[check_pgsql]=/usr/local/libexec/nagios/check_pgsql -H 10.16.255.64
Replacing 10.16.255.64 with the IP address the PostgreSQL server is listening on.
Remember to restart NRPE after changing the config:
sudo /usr/local/etc/rc.d/nrpe2 restart