Anyone use Nagios? Need some help.

Kanwar Ranbir Sandhu m3freak at rogers.com
Tue Jul 27 14:26:34 UTC 2004


On Tue, 2004-07-27 at 08:36, Scot L. Harris wrote:
> If it is a path type issue why not hard code the full path of the
> program into the script?  That should either prove or disprove the
> theory very quickly.  Look for the place in the script that the program
> is call and put the full path to it there.

Great suggestion, but now I feel dumb.  I actually looked through the
script yesterday and upon finding the line where "rpcinfo" is supposed
to be called, I noticed that it was a bit odd in the way it was
specified.  I didn't even consider changing it just to see what would
happen.  

Anyway, this is what the original line looks like (wrapped):

$cmd = "$utils::PATH_TO_RPCINFO $port -" . "$proto $host $prognum
$progver 2>&1 |";

I changed it to this:

$cmd = "/usr/sbin/rpcinfo $port -" . "$proto $host $prognum $progver
2>&1 |";

And viola, it worked. Here's the output:

OK: RPC program nfs version 2 version 3 udp running

Yes! :) I also tried this:

$cmd = "$utils::/usr/sbin/rpcinfo $port -" . "$proto $host $prognum
$progver 2>&1 |";

I received a result, but also an error:

Use of uninitialized value in concatenation (.) or string at
/usr/lib/nagios/plugins/check_rpc line 307.
OK: RPC program nfs version 2 version 3 udp running

I'm assuming it's referring to this part of the line: " . " but I don't
know exactly what to do with it.  I tried it this way only because the
variable "$utils" seemed important and the code seems to say to put the
path to the rpcinfo program after the colons.  Since the first version
didn't produce any errors, I'm going to stick with that one.

> Double check the permissions on the file also.  If it is owned by root
> but has 700 type permissions that may cause the same thing.
> 
> And based on the PATH environment variable above /usr/sbin is not
> included in that.  And with /bin/sh set as that users shell the
> .bash_profile will not be used.  I think you would need to put the PATH
> variable in .profile for that shell.  I am a little rusty with that but
> I think that is right.

These were good suggestions as well.  But, now that I have it working,
I'm going to leave well enough alone.

Thanks for the help.  I very much appreciate it.

Regards,

Ranbir

-- 
Ranbir
Systems Aligned Inc.
www.systemsaligned.com





More information about the fedora-list mailing list