Hi, i've Nagios 3 and i'm tryin to put a script in a host.
Script run OK on sh, ksh, bash but when running from Nagios server always return OK.
nagios@sdd11:/usr/lib/nagios/plugins> ./check_nrpe -H sd1 -c check_informix
ok
nagios@sdd11:/usr/lib/nagios/plugins> ./check_informix.sh
NOOO
#!/bin/sh
estado="$(/opt/mw/bin/ifxcheck tarcred sdd narplus meta4)"
tarcred=$(echo $estado | cut -d" " -f1)
if [[ "$tarcred" -ge 30 ]];then
alarma=1
fi
if [[ $alarma -eq 1 ]];then
echo "NOOO"
exit 2
else
echo "ok"
exit 0
fi
Problem with script.
-
- Posts: 15
- Joined: Wed Mar 04, 2015 6:37 am
Re: Problem with script.
ok thanks for post my problem!!!
i know where is the problem:
estado="$(/opt/mw/bin/ifxcheck tarcred sdd narplus meta4)"
it execute ifxcheck but it look like it's not passing the arguments (tarcred sdd narplus meta4) how can i do to pass it?
i know where is the problem:
estado="$(/opt/mw/bin/ifxcheck tarcred sdd narplus meta4)"
it execute ifxcheck but it look like it's not passing the arguments (tarcred sdd narplus meta4) how can i do to pass it?
Re: Problem with script.
Can you post the nrpe command directive for check_informix?
Also, is "sd1" the localhost, or another remote box?
Also, is "sd1" the localhost, or another remote box?
jmasquelet wrote: nagios@sdd11:/usr/lib/nagios/plugins> ./check_nrpe -H sd1 -c check_informix
ok
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
- Posts: 15
- Joined: Wed Mar 04, 2015 6:37 am
Re: Problem with script.
its localhost.
./check_nrpe -H localhost -c check_informix
./check_nrpe -H localhost -c check_informix
Re: Problem with script.
Can you add a few echos to the script and then rerun it through nrpe and from the command line? (post the results)
And then run:
Code: Select all
#!/bin/sh
estado="$(/opt/mw/bin/ifxcheck tarcred sdd narplus meta4)"
echo "$estado"
tarcred=$(echo $estado | cut -d" " -f1)
echo "tarcred"
if [[ "$tarcred" -ge 30 ]];then
alarma=1
fi
if [[ $alarma -eq 1 ]];then
echo "NOOO"
exit 2
else
echo "ok"
exit 0
fi
Code: Select all
./check_nrpe -H localhost -c check_informix
./check_informix
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
- Posts: 15
- Joined: Wed Mar 04, 2015 6:37 am
Re: Problem with script.
result for ./check_informix.sh
nagios@sdd11:/usr/lib/nagios/plugins> ./check_informix.sh
622 72 53 335
622
NOOO
result for ./check_nrpe -H localhost -c check_informix
nagios@sdd11:/usr/lib/nagios/plugins> ./check_nrpe -H localhost -c check_informix
ok
nagios@sdd11:/usr/lib/nagios/plugins> ./check_informix.sh
622 72 53 335
622
NOOO
result for ./check_nrpe -H localhost -c check_informix
nagios@sdd11:/usr/lib/nagios/plugins> ./check_nrpe -H localhost -c check_informix
ok
Re: Problem with script.
If SELinux is on, does this work with SELinux turned off?
Since there are two blank spaces above your 'ok' in the second example, that means there is no output value for the echoes abris suggested. It looks like when the script is run via NRPE it cannot check "/opt/mw/bin/ifxcheck".
Since the Nagios user can check '/opt/mw/bin/ifxcheck' properly on the command line, that leads me to believe that SELinux is a possible culprit.
If that does not help, could you please post the results of the following commands:
Code: Select all
setenforce 0
./check_nrpe -H localhost -c check_informix
Since the Nagios user can check '/opt/mw/bin/ifxcheck' properly on the command line, that leads me to believe that SELinux is a possible culprit.
If that does not help, could you please post the results of the following commands:
Code: Select all
cat /etc/xinetd.d/nrpe.conf
cat /usr/local/nagios/etc/nrpe.cfg