Page 1 of 1

Value Not Returning with NRPE

Posted: Wed Jan 10, 2018 1:43 pm
by danielgaraventa_ats
Hello,

We have a custom check that we have written for our Oracle database servers to check the number of days left until passwords expire via an SQL command. We are currently testing on moving our databases to RHEL 7 from SUSE 11. Running on SUSE 11 the check works as expected when we run the script through NRPE. On RHEL 7 the output from the SQL command does not seem to be being passed to NRPE It does work fine however when I run the script locally on the RHEL 7 server.

Code: Select all

#!/bin/bash

# Nagios return codes
UNKNOWN=3
CRIT=2
WARN=1
OK=0

OUT=$(/opt/oracle/product/11.2.0.4/bin/sqlplus -S redacted/redacted@svr-rhel7/SID << EOF
set head off;
select nvl( min(trunc(expiry_date) - trunc(sysdate)),90) days_remaining from dba_users u where expiry_date is not null and account_status = 'OPEN';
exit
EOF
)

export OUT

if test "$OUT" -gt 30; then
  echo "OK - Passwords are not set to expire for another "$OUT" days"
  exit $OK
elif test "$OUT" -gt 14; then
  echo "WARN - Passwords are scheduled to expire in "$OUT" days"
  exit $WARN
else
  echo "CRIT - Passwords are scheduled to expire in "$OUT" days"
  exit $CRIT
fi

When I run the script locally on the RHEL 7 box I get the following output.

Code: Select all

[root@svr-rhel7 plugins]# runuser -u nrpe /usr/lib64/nagios/plugins/test2
OK - Passwords are not set to expire for another  90 days
When I run the check_nrpe on our Nagios XI server I see the following output.

Code: Select all

[root@monitor libexec]# ./check_nrpe -H svr-rhel7 -t 60 -p 5666 -4 -c test2
CRIT - Passwords are scheduled to expire in  days
We are currently running Nagios XI 5.4.11 and I have set SELinux into permissive mode on the RHEL 7 server.

Thank you for any advice,
Daniel

Re: Value Not Returning with NRPE

Posted: Wed Jan 10, 2018 2:37 pm
by npolovenko
@danielgaraventa_ats, I think you already posted this question in the customer section. Should we lock this thread and move forward with the other one since it has a higher priority?
https://support.nagios.com/forum/viewto ... 989#241460