Page 1 of 1

nrpe bash script & functions

Posted: Tue Jan 27, 2015 2:02 am
by ramann
hi @all,

I wrote a bash script to make some checks. I execute this script via the nrpe- agent. When I execute this script direct on the host, everything is fine.
But when I use the nrpe agent, the function which I defined in my script are executet directly without calling this function.

Example:

#!/bin/bash
RESULT=INIT'
function f_ok {
echo "OK: "${RESULT}
exit 0
}

if [ -d XXX]; then
do some tests
NOT_FALL_FUNCTION
fi
NOT_FALL_FUNCTION


The agent calls only f_ok direct and my scripts stops with "OK INIT" to do anything else.

NRPE Version: 2.13
Nagios XI 2011R2.2

Any ideas?

Thanks
bjoern

Re: nrpe bash script & functions

Posted: Tue Jan 27, 2015 4:12 pm
by tgriep
Could you post the configuration for how the check_nrpe is setup for your bash script?

Re: nrpe bash script & functions

Posted: Thu Jan 29, 2015 10:12 am
by ramann
Do you mean the command definition on the nagios host?

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$

arg1: check_filecount

Re: nrpe bash script & functions

Posted: Thu Jan 29, 2015 12:11 pm
by scottwilkerson
ramann wrote:Do you mean the command definition on the nagios host?

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$

arg1: check_filecount
No, how about the configuration line in the NRPE config.

Thanks