check_pgsql run through check_nrpe fails

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
seatonc
Posts: 2
Joined: Fri Jun 14, 2019 3:25 am

check_pgsql run through check_nrpe fails

Post by seatonc »

I am new to Nagios and am attempting to set up monitoring of a postgres database. I'm taking over from someone else and working on a fairly complicated system. I'm working through the details by setting up monitoring on a new VM (the database system).

I have nrpe installed and running on the database system, and nagios server set up and running on another system. I have a .cfg file in /etc/nrpe.d/ on the database system that contains the command to run check_pgsql:

Code: Select all

command[check_pgsql-os]=usr/lib64/nagios/plugins/check_pgsql -l postgres
If I run that command locally as root, it successfully returns an "OK - database template1" status line.

If I run that command remotely from the nagios server system using check_nrpe

Code: Select all

check_nrpe -H dbsystem -t 60 -c check_pgsql-os 
It returns:

Code: Select all

CRITICAL - no connection to 'template1' (could not connect to server: Permission denied
        Is the server running locally and accepting 
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
)
I have another check on the database system that uses check_disk, which is also run remotely using check_nrpe, and that check runs successfully and returns an "OK" status line.

Nagios server system is Centos 6, database system is Centos 7, database is Postgres 11.3

Any advice on why check_pgsql would run successfully when run locally and fail when run through check_nrpe would be greatly appreciated.
seatonc
Posts: 2
Joined: Fri Jun 14, 2019 3:25 am

Re: check_pgsql run through check_nrpe fails

Post by seatonc »

To answer my own question, SELinux was enabled on the database system. Disabling SELinux on the database system fixed the problem and check_pgsql works remotely now.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_pgsql run through check_nrpe fails

Post by scottwilkerson »

seatonc wrote:To answer my own question, SELinux was enabled on the database system. Disabling SELinux on the database system fixed the problem and check_pgsql works remotely now.
Good to hear it is resolved!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked