NRPE: Unable to read output
Re: NRPE: Unable to read output
Hi,
I have a similar problem. I have a perl script to check the status of postgres database.
NRPE client runs off xinetd service and not as a seperate daemon and firewall is disabled.
On the client when i run the check status using the script it works fine.
/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER
POSTGRES_CONNECTION OK: DB "DB_NAME" version 9.3.4 | time=0.04s
But when i run the same check using the command alias it doesn't work and gives the following error.
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 0 -c check_postgres_connection
NRPE: Unable to read output
grep check_postgres_connection ../etc/nrpe.cfg
command[check_postgres_connection]=/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER
I haven't setup any sudo rules as nagios user has permissions to execute these scripts and is used by nagios user.
ls -l check_postgres.pl
-rwxr-xr-x. 1 nagios nagios 372014 Feb 11 16:00 check_postgres.pl
I have even checked as nagios user and it works absolutely fine. Command check alias works absolutely fine on another host, But not on this one. I am running out of ideas. Please suggest a solution.
su - nagios -s /bin/bash -c "/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME--port=5432 --dbuser=DB_USER"
POSTGRES_CONNECTION OK: DB "postgres" version 9.3.4 | time=0.01s
I have a similar problem. I have a perl script to check the status of postgres database.
NRPE client runs off xinetd service and not as a seperate daemon and firewall is disabled.
On the client when i run the check status using the script it works fine.
/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER
POSTGRES_CONNECTION OK: DB "DB_NAME" version 9.3.4 | time=0.04s
But when i run the same check using the command alias it doesn't work and gives the following error.
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 0 -c check_postgres_connection
NRPE: Unable to read output
grep check_postgres_connection ../etc/nrpe.cfg
command[check_postgres_connection]=/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER
I haven't setup any sudo rules as nagios user has permissions to execute these scripts and is used by nagios user.
ls -l check_postgres.pl
-rwxr-xr-x. 1 nagios nagios 372014 Feb 11 16:00 check_postgres.pl
I have even checked as nagios user and it works absolutely fine. Command check alias works absolutely fine on another host, But not on this one. I am running out of ideas. Please suggest a solution.
su - nagios -s /bin/bash -c "/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME--port=5432 --dbuser=DB_USER"
POSTGRES_CONNECTION OK: DB "postgres" version 9.3.4 | time=0.01s
Re: NRPE: Unable to read output
ae07177,
If you run check_nrpe with no arguments, does it work properly?
This is very commonly caused by permissions problems. Is selinux running?
Check your default requiretty setting:
If you run check_nrpe with no arguments, does it work properly?
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
Code: Select all
sestatus
Code: Select all
cat /etc/sudoers | grep tty
Re: NRPE: Unable to read output
Hi Jolson,
Thanks for the reply.
Yes, check_nrpe works properly and alia for several others apart from Postgres DB check works fine.
eg::
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_disk_/
DISK OK - free space: / 980 MB (68% inode=88%);| /=454MB;1359;1435;0;1511
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_swap
SWAP OK - 100% free (4091 MB out of 4091 MB) |swap=4091MB;818;409;0;4091
Selinux status, although i dont think it is causing the problem.
sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: disabled
Policy version: 24
Policy from config file: targeted
Coming to tty setting in /etc/sudoers, User "nagios" already has permissions for "check_postgres.pl" script. And it runs properly when executed as nagios user.
I havent setup any sudo rules. Would it still matter?
grep tty /etc/sudoers | grep -v ^#
Defaults requiretty
ls -l /usr/local/nagios/libexec/check_postgres.pl
-rwxr-xr-x. 1 nagios nagios 372014 Feb 11 16:00 /usr/local/nagios/libexec/check_postgres.pl
"nagios" user appears to be able to execute "postgres" check script properly.
su - nagios -s /bin/bash -c "/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER"
POSTGRES_CONNECTION OK: DB "DB_NAME" version 9.3.4 | time=0.03s
Please advise
Thanks for the reply.
Yes, check_nrpe works properly and alia for several others apart from Postgres DB check works fine.
eg::
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_disk_/
DISK OK - free space: / 980 MB (68% inode=88%);| /=454MB;1359;1435;0;1511
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_swap
SWAP OK - 100% free (4091 MB out of 4091 MB) |swap=4091MB;818;409;0;4091
Selinux status, although i dont think it is causing the problem.
sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: disabled
Policy version: 24
Policy from config file: targeted
Coming to tty setting in /etc/sudoers, User "nagios" already has permissions for "check_postgres.pl" script. And it runs properly when executed as nagios user.
I havent setup any sudo rules. Would it still matter?
grep tty /etc/sudoers | grep -v ^#
Defaults requiretty
ls -l /usr/local/nagios/libexec/check_postgres.pl
-rwxr-xr-x. 1 nagios nagios 372014 Feb 11 16:00 /usr/local/nagios/libexec/check_postgres.pl
"nagios" user appears to be able to execute "postgres" check script properly.
su - nagios -s /bin/bash -c "/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=DB_NAME --port=5432 --dbuser=DB_USER"
POSTGRES_CONNECTION OK: DB "DB_NAME" version 9.3.4 | time=0.03s
Please advise
Re: NRPE: Unable to read output
Can you try it with selinux disabled, we recommend that it be disabled.
You can run the command below to temporarily turn it off:
You can turn it off permanently with by editing /etc/sysconfig/selinux and changing the line from:
To:
You can run the command below to temporarily turn it off:
Code: Select all
setenforce 0
Code: Select all
SELINUX=enforcing
Code: Select all
SELINUX=disabled
Re: NRPE: Unable to read output
Hi,
It is already disabled.
getenforce
Permissive
grep ^SELINUX /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
It is already disabled.
getenforce
Permissive
grep ^SELINUX /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: NRPE: Unable to read output
ae07177 wrote: getenforce
Permissive
Permissive != Disabled
I think selinux is your problem. Please test with it disabled.
Once you have the following:
Code: Select all
[jdalrymple@localhost ~]$ sestatus
SELinux status: disabled
Re: NRPE: Unable to read output
Hi,
I tried copying a new postgres check script. But it is giving me another error. I have set the path in "/etc/profile" as well. But it doesnt work.
Please help.
[root@Fillet etc]# grep postgres nrpe.cfg
command[check_postgres_connection_db-name]=/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=db-name --port=5432 --dbuser=db_user 2>&1
[root@Fillet etc]# /usr/local/nagios/libexec/check_postgres.pl --action=connection --db=db-name --port=5432 --dbuser=db_user
POSTGRES_CONNECTION OK: DB "db-name" version 9.3.4 | time=0.02s
[root@Fillet etc]#
[root@Fillet etc]#
[root@Fillet etc]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_postgres_connection_db-name
which: no psql in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Could not find a suitable psql executable
[root@Fillet etc]#
[root@Fillet etc]# which psql
/home/data/PostgresPlus/9.3/bin/psql
[root@Fillet etc]#
I tried copying a new postgres check script. But it is giving me another error. I have set the path in "/etc/profile" as well. But it doesnt work.
Please help.
[root@Fillet etc]# grep postgres nrpe.cfg
command[check_postgres_connection_db-name]=/usr/local/nagios/libexec/check_postgres.pl --action=connection --db=db-name --port=5432 --dbuser=db_user 2>&1
[root@Fillet etc]# /usr/local/nagios/libexec/check_postgres.pl --action=connection --db=db-name --port=5432 --dbuser=db_user
POSTGRES_CONNECTION OK: DB "db-name" version 9.3.4 | time=0.02s
[root@Fillet etc]#
[root@Fillet etc]#
[root@Fillet etc]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_postgres_connection_db-name
which: no psql in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Could not find a suitable psql executable
[root@Fillet etc]#
[root@Fillet etc]# which psql
/home/data/PostgresPlus/9.3/bin/psql
[root@Fillet etc]#
Re: NRPE: Unable to read output
Also not able to check oracle database tablespace usage on another server. Please help. Following are the error details.
Hi Team,
I have another issue where i can check the oracle tablespace usage by running the "check_oracle_tablespace" script. But get an error while checking with "check_nrpe" script. Please advise.
Doesnt work::
tntb-a:/usr/local/nagios/etc # /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_oracle_tablespace_ATLAS_ATLAS_DATA
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
/usr/local/nagios/libexec/check_oracle: line 284: [: : integer expression expected
/usr/local/nagios/libexec/check_oracle: line 288: [: : integer expression expected
/usr/local/nagios/libexec/check_oracle: line 292: [: : integer expression expected
ATLAS : ATLAS_DATA OK - % used [ / MB available ]|ATLAS_DATA=%;85;95;0;100
tntb-a:/usr/local/nagios/etc #
This Works::
tntb-a:/usr/local/nagios/etc # /usr/local/nagios/libexec/check_oracle_tablespace ATLAS ATLAS_DATA
ATLAS : ATLAS_DATA OK - 84.50% used [ 3893 / 25000 MB available ]|ATLAS_DATA=84.50%;85;95;0;100
tntb-a:
Thanks
Arvind
Hi Team,
I have another issue where i can check the oracle tablespace usage by running the "check_oracle_tablespace" script. But get an error while checking with "check_nrpe" script. Please advise.
Doesnt work::
tntb-a:/usr/local/nagios/etc # /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_oracle_tablespace_ATLAS_ATLAS_DATA
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
/usr/local/nagios/libexec/check_oracle: line 284: [: : integer expression expected
/usr/local/nagios/libexec/check_oracle: line 288: [: : integer expression expected
/usr/local/nagios/libexec/check_oracle: line 292: [: : integer expression expected
ATLAS : ATLAS_DATA OK - % used [ / MB available ]|ATLAS_DATA=%;85;95;0;100
tntb-a:/usr/local/nagios/etc #
This Works::
tntb-a:/usr/local/nagios/etc # /usr/local/nagios/libexec/check_oracle_tablespace ATLAS ATLAS_DATA
ATLAS : ATLAS_DATA OK - 84.50% used [ 3893 / 25000 MB available ]|ATLAS_DATA=84.50%;85;95;0;100
tntb-a:
Thanks
Arvind
Re: NRPE: Unable to read output
The check_nrpe is usually used to run checks on a remote server... Are you running this check locally (with check_nrpe)? What is the output of the following command?[root@Fillet etc]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_postgres_connection_db-name
which: no psql in (/sbin:/usr/sbin:/bin:/usr/bin)
Code: Select all
echo $PATH
Be sure to check out our Knowledgebase for helpful articles and solutions!