Page 1 of 1

NRPE retrieveing weird results

Posted: Mon Aug 17, 2020 2:56 am
by cosmin.neagu01
Hello,

I have a local script on a postfix server that checks the emails procesed. Locally the script runs just fine, getting the proper results when run as nagios user.
But when I try to run the same command through NRPE, it always returns 0 as value.
Some help would be appreciated to find out what's wrong with this setup, never seen such a weird behavior with NRPE
NRPEv4.0.2
NagiosV4.4.6



On postfix server:
nagios@postfix:/usr/local/nagios/etc$ whoami
nagios
nagios@postfix:/usr/local/nagios/etc$ /usr/local/nagios/libexec/check_postfix_processed2 -w 50 -c 100
Messages processed in the last 300 seconds: 3 | mailsprocessed=3
nagios@postfix:/usr/local/nagios/etc$ cat nrpe.cfg | grep postfix_proc
command[check_postfix_processed2]=/usr/local/nagios/libexec/check_postfix_processed2 -w 50 -c 100

On nagios server via NRPE:
nagios@AZNO-PRD-NAG001:/usr/local/nagios/libexec$ ./check_nrpe -H 172.18.249.10 -c check_postfix_processed2
Messages processed in the last 300 seconds: 0 | mailsprocessed=0

Re: NRPE retrieveing weird results

Posted: Tue Aug 18, 2020 8:40 am
by pelle_viktor
Are you using $PATH or $HOME or any other system variables in you script?

Re: NRPE retrieveing weird results

Posted: Tue Aug 18, 2020 5:28 pm
by benjaminsmith
@pelle_viktor Thanks for helping out!

Are you getting the expected exit codes when using nrpe?