NRPE problem

Hello!
I’ve got a problem with Nagios NRPE plugin. The idea is to run a
command that tells me, if a Oracle TNS Listener is running on a remote
host. When I execute the following command locally:
$ ps -ef | grep -v grep | grep -c "tnslsnr"
i get a result: 1 (or more) when a tnslsnr is running
0 - when it’s not.

Here is the problem: i defined this command in the nrpe.cfg file. When
executing it via NRPE Nagios plugin I get the information that no
Listener is running on a remote host, but when I log in on that host I
can see clearly, that the listener process is running. I’ve got no
idea how to solve it. I’d like to add that the amount of other
processes that i check locally and via NRPE (e.g. bash or Oracle
instances) is equal. I’ve got 8 servers operating under SuSe and
RedHat, each is configured in the same way, but 3 of them aren’t
giving me the proper information about TNSListener. Can anyone help
me?

Thanks in advance:)

PS. Already checked spelling. Everything is all right with it,

To debug, try this :
ps -ef | grep -v grep | grep “tnslsnr” | tee /tmp/ps.$$ | wc -l

(Also consider making a wrapper script for it)

Every time the script runs, the ps contents will be carbon copied in a file in /tmp called ps.[number] (the number was the process id)

Also - is it possible that the case changes of ‘tnslsnr’ (eg TNSlsnr) - try adding -i to the grep to make it case insensitive

it’s not the case of case sensivity or misspelling. I’m monitoring 10 hosts running on either RedHat or SuSe. I copy-pasted this command "ps -ef | grep -v grep | grep -c “tnslsnr” to each one of them. On some of them it’s running great and on the others - it’s not running at all. It doesn’t find any listener process despite I can see it in processes list.

This command ("ps -ef | grep -v grep | grep -c “XXX”) for any XXX but “tnslsnr” gives the same result (amount of processes) executed locally and via NRPE. I have no clue why it isn’t working for “tnslsnr”.

One thing to consider is try su’ing to the user NRPE runs as and try the command again.