nrpe bash script & functions

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ramann
Posts: 2
Joined: Wed Jan 21, 2015 10:22 am

nrpe bash script & functions

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: nrpe bash script & functions

Post by tgriep »

Could you post the configuration for how the check_nrpe is setup for your bash script?
Be sure to check out our Knowledgebase for helpful articles and solutions!
ramann
Posts: 2
Joined: Wed Jan 21, 2015 10:22 am

Re: nrpe bash script & functions

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nrpe bash script & functions

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked