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 check 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
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
Thank you for any advice,
Daniel