[Nagiosplug-help] check_nrpe

David Shapiro david.shapiro at btitele.com
Wed Jul 10 05:12:10 CEST 2002


Because my program uses use Env module, and I then assign the environment
variables within the chkoracle.pl, it is not an issue with the environment.
I determined that by using expect's $expect->log_user(0) option to turn off
STDOUT for the expect portion of my program, it correctly gets my print
statement and exit code.  It now works fine.  I want to make sure this
follows the format of other nagios scripts, and I will submit it as a
contribution.

David

-----Original Message-----
From: Jackson Sie [mailto:jsie at quadrix.com]
Sent: Tuesday, July 09, 2002 10:59 PM
To: David Shapiro; nagiosplug-help at lists.sourceforge.net
Subject: RE: [Nagiosplug-help] check_nrpe


David,

Perhaps I need to clarify my original statement, let me know if I'm pursuing
the wrong line of thinking...

As I understand it, when nrpe on the remote machine is called to run a
plug-in, it ultimately calls popen() to fork the actual shell that contains
the "real" call chkoracle.pl on the remote machine.  Reading the man page
for popen() on my Solaris 8 box, I see the following statement:

<SNIP>
     The environment of the executed command  will  be  as  if  a
     child  process  were  created  within the popen() call using
     fork(2). If  the  application  is  standard-conforming  (see
     standards(5)), the child is invoked with the call:

          execl("/usr/bin/ksh", "ksh", "-c", command, (char *)0);

     otherwise, the child is invoked with the call:

          execl("/usr/bin/sh", "sh", "-c", command, (char *)0);
</SNIP>

Continuing the man page reading, for fork(2) I see:

<SNIP>
     The fork() and fork1() functions create a new  process.  The
     new  process (child process) is an exact copy of the calling
     process (parent process). The  child  process  inherits  the
     following attributes from the parent process:

        o  real user ID, real group ID, effective user ID, effec-
           tive group ID

        o  environment
</SNIP>

So net net, this would mean that the chkoracle.pl script runs with the
environment of the nrpe daemon, not your login shell.  Any chance there's a
discrepancy there?

Regards,
Jackson


P.S. Any particular reason you are using Expect within Perl to invoke
SQLPlus on a remote machine via NRPE?  Perhaps I that would help me
understand what's going on.



-----Original Message-----
From: nagiosplug-help-admin at lists.sourceforge.net
[mailto:nagiosplug-help-admin at lists.sourceforge.net]On Behalf Of David
Shapiro
Sent: Tuesday, July 09, 2002 4:27 PM
To: 'Jackson Sie'; David Shapiro; nagiosplug-help at lists.sourceforge.net
Subject: RE: [Nagiosplug-help] check_nrpe


The environment is okay.  I use perl's use Env module to handle environment
variables.  It looks like a problem with using expect.pm with nrpe.  Expect
has its own exit that it does with no options (i.e., STATUS_WARNINGS, 1, 2 ,
whatever, etc.).  So, although my perl script does not exit, within it
another program (expect) does have an exit.  Consequently, my print
statement and exit code, which come after Expect exists from running
sqlplus, are ignored, so nrpe thinks it got no output to print to screen or
an exit code.  I need to see if I can send my print statement and exit
before expect finishes and sends an exit.

-----Original Message-----
From: Jackson Sie [mailto:jsie at quadrix.com]
Sent: Tuesday, July 09, 2002 11:57 AM
To: David Shapiro; nagiosplug-help at lists.sourceforge.net
Subject: RE: [Nagiosplug-help] check_nrpe


David,

This is very likely a problem with your LD_LIBRARY_PATH (assuming a
Linux-like OS).  As a test, you might wrap your chkoracle.pl script with a
simple shell script to spit out what it thinks the current env looks like.
We had a similar problem trying to get the check_snmp to work.

Regards,
Jackson Sie
Senior Architect
Quadrix Solutions, Inc.



-----Original Message-----
From: nagiosplug-help-admin at lists.sourceforge.net
[mailto:nagiosplug-help-admin at lists.sourceforge.net]On Behalf Of David
Shapiro
Sent: Tuesday, July 09, 2002 9:02 AM
To: 'nagiosplug-help at lists.sourceforge.net'
Subject: [Nagiosplug-help] check_nrpe


Hello,

I made a script that uses expect.pm/perl  to sqlplus login to sids and
return errors if logins fail for some reason.  I used the exit codes from
config.sh.  Anyway, the script works from the command line fine:

# /usr/local/bin/bti/chkoracle.pl --login system/test --oracle 816

SQL*Plus: Release 8.1.6.0.0 - Production on Tue Jul 9 08:52:45 2002

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

ERROR:
ORA-01034: ORACLE not available


Enter user-name: SQLPLUS: Oracle 816 unavailable. Check if Oracle down,
Invalid SID used, or oraenv settings not correctly set.

But using check_nrpe:
# /usr/local/nagios/libexec/check_nrpe 10.1.1.1 -to 60 -c
'check_db_sqlplus_816'
CHECK_NRPE: Receive underflow.  Only 12 bytes received (1040 expected).

What is happening here? What is this underflow error?  What is going on?



David E. Shapiro




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Nagiosplug-help mailing list
Nagiosplug-help at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-help


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Nagiosplug-help mailing list
Nagiosplug-help at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-help




More information about the Help mailing list