check_pgsql run through check_nrpe fails

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

check_pgsql run through check_nrpe fails

Postby seatonc » Fri Jun 14, 2019 3:14 pm

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

Postby seatonc » Sat Jun 15, 2019 1:03 am

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.
seatonc
 
Posts: 2
Joined: Fri Jun 14, 2019 3:25 am

Re: check_pgsql run through check_nrpe fails

Postby scottwilkerson » Mon Jun 17, 2019 6:35 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15685
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot] and 10 guests