solaris10 running nrpe under SMF. scripts with backticks = n

I’m stumped. I have some Solaris 10 servers that I compiled and have running. CPU, disk space and some other plugins are working, as long as they don’t rely on backticks in the script. If it does, I can’t get any output back to the nagios host.

I was troubleshooting the check_oracle plugin and eventually tracked it down to being an issue all scripts that contain backticks.

Even the most simple script returns no output back to the nagios host(yet it will work of course if run as user nagios from the ssh console):
ie.

#! /bin/sh
test=ps
echo "$test"
exit

should return:

./check_test

PID TTY TIME CMD
24186 pts/2 0:00 ps
24184 pts/2 0:00 bash
24183 pts/2 0:00 sh
24185 pts/2 0:00 check_te

but doesnt…

I have tried changing nrpe service so it doesn’t inherit the env, and have tried giving the nagios account extra permissions as a service account. Still no luck.

Has anyone dealt with this issue before?? The Solaris security model is driving me bonkers. Any help would be much apprecated!

-J

that’s weird:
I’ve just tried on a few solaris 10 the same script:

nagios@nr0u0617:/appli/nagios>test.sh
PID TTY TIME CMD
23036 pts/3 0:00 test.sh
9287 pts/3 0:00 ksh
23039 pts/3 0:00 ps
9485 pts/3 0:00 bash
nagios@nr0u0617:/appli/nagios> uname -a
SunOS nr0u0617 5.10 Generic_118833-36 sun4v sparc SUNW,Sun-Fire-T200

I’d say it’s more an issue of your sh than your OS.
Maybe you could try changing /bin/sh by /bin/ksh, or /usr/bin/sh or /usr/bin/ksh or whatever (or just compile another sh version).

or, if everything fails, post it on a solaris forum; you should get better answers than here :wink:

Thanks for the reply Loose. I’ll post a more descriptive explanation, and if I have to I’ll start posting on the Solaris forums too:

From Sun Server — Works:
SunOS 5.10 Generic_127127-11 sun4v sparc SUNW,SPARC-Enterprise-T5220

-bash-3.00$ ./check_test
PID TTY TIME CMD
21393 pts/1 0:00 ps
21364 pts/1 0:00 bash
21391 pts/1 0:00 check_te

just to verify the nrpe.cfg script:
command[check_test]=/usr/local/nagios/libexec/check_test
looks good…

From Nagios server — No output from backtick script commands:

[nagmin@nagios01 libexec]$ ./check_nrpe -H ipaddr -c check_test
CHECK_NRPE: No output returned from daemon.

Of course if we change the name of the script to something invalid I get:

[nagmin@nagios01 libexec]$ ./check_nrpe -H ipaddr -c check_test1
NRPE: Command ‘check_test1’ not defined

So I know that nagios is properly connecting to nrpe.

At this point I gave the nagios service account on the Solaris 10 root powers for testing, and I told SMF not to inherit the env, so that it can be set by the script.

Any other suggestions are welcome. I’m off to the Sun forums : )

Thanks

-J

oh, sorry: I didn’t get your problem right :slight_smile:
before posting, could you tryy to change your script in this way:
use the full command path:
“which ps
/usr/bin/ps”

=>

#! /bin/sh
test=/usr/bin/ps
echo "$test"
exit

that’s not much, but it might work better (I hope so anyway);
please post again if it doesn’t ^^