<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>Problem running Check_sap.pl under ePN</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Courier New">Background:</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">OS Version:             Fedora Core release 5 (Bordeaux)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Perl Version:   perl-5.8.8-5 (from FC 5)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Nagios Version: nagios-2.5-2.fc5 (from FC 5)</FONT>

<BR>                        <FONT SIZE=2 FACE="Courier New">nagios-devel-2.5-2.fc5 (from FC 5)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Nagios::Plugin: Nagios-Plugin-0.14.tar.gz (installed using CPAN)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Check_sap.pl:   $Revision: 1.4 $ / $Date: 2006/10/14 08:38:18 $ / wob (downloaded from nagiosexchange.org)</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">I can run the check from the nagios user's shell:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">[nagios@lutetia ~]$ /usr/local/bin/check_sap.pl --ashost=qr3-ci --sap-sysnr=02</FONT>

<BR><FONT SIZE=2 FACE="Courier New">CHECK_SAP OK - system qr3 available</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">But when run from the ePN with the nagios daemon I get the following error:</FONT>

<BR>                <FONT SIZE=2 FACE="Courier New">**ePN failed to compile /usr/local/bin/check_sap.pl: "Missing right curly or square bracket at (eval 1) line 301, at end of line </FONT></P>

<P><FONT SIZE=2 FACE="Courier New">Clearly ePN is parsing the script differently from regular perl.  I know perl check script writers have to obey stricter rules than regular perl scripts to function correctly in the ePN environment, but I am not the author of check_sap.pl and clearly that person has had to deal with Nagios::Plugin before so I thought it would make sense to appeal to the mailing list for help.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">Line 301 is:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    298    return $version;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    299 }</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    300</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    301 __END__</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    302 # ===============================================</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    303</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    304 =head1 AUTHOR</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    305</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">I thought it maybe had to do with the PODification of the script but using Perl::Tidy to remove the documentation only changes and moves the error.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">I've noted the warning about using Nagios::Plugin needing to be above 0.12 on the nagiosexchange page for check_sap.pl.  </FONT></P>

<P><FONT SIZE=2 FACE="Courier New">Although I understand that compiled nagios includes an embedded perl engine and that it interprets perl check scripts somehow using p1.pl and that the above error has to do with how that mechanism is failing to load and compile the script, I certainly don't understand the details.  Is there a way to invoke a perl check script in an embedded perl environment similar to how the nagios process does for the purposes of debugging?</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">I notice that /usr/sbin/p1.pl includes some debugging which I turned on:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">diff /usr/sbin/p1.pl /usr/sbin/p1.pl.orig</FONT>

<BR><FONT SIZE=2 FACE="Courier New">14c14</FONT>

<BR><FONT SIZE=2 FACE="Courier New">< #use constant DEBUG_LEVEL             => 0 ;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">---</FONT>

<BR><FONT SIZE=2 FACE="Courier New">> use constant  DEBUG_LEVEL             => 0 ;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">18c18</FONT>

<BR><FONT SIZE=2 FACE="Courier New">< use constant  DEBUG_LEVEL             => LEAVE_MSG | CACHE_DUMP | PLUGIN_DUMP ;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">---</FONT>

<BR><FONT SIZE=2 FACE="Courier New">> # use constant        DEBUG_LEVEL             => LEAVE_MSG | CACHE_DUMP | PLUGIN_DUMP ;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">But his only seems to give me information I already had, that it is having problems parsing the check script:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">[root@lutetia var]# head epn_leave-msgs.log</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Mon Oct 30 14:55:21 2006 eval_file: syntax error in /usr/local/bin/check_sap.pl: "Missing right curly or square bracket at (eval 1) line 301, at end of line</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">syntax error at (eval 1) line 308, at EOF".</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Mon Oct 30 14:55:47 2006 eval_file: /usr/local/bin/check_sap.pl failed compilation formerly and file has not changed; skipping compilation.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">The plugin dump file has 3 x 4kB of the data and is clearly check script prepended with the following:</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">         1  package Embed::usr::local::bin::check_5fsap_2epl;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         2</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         3  sub hndlr {</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         4      @ARGV = @_ ;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         5      local $^W = 1 ;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         6</FONT>

<BR><FONT SIZE=2 FACE="Courier New">         7                                                              # <<< START of PLUGIN (first line of plugin is line 8 in the</FONT></P>

<P><FONT SIZE=2 FACE="Courier New"> text) >>></FONT>

<BR><FONT SIZE=2 FACE="Courier New">         8  #!/usr/bin/perl</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">And that doesn't help me understand how it is parsing the script differently.</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Has anyone seen a problem like this before?  I've looked for obvious things like POD causing compilation to be different but with no luck.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">I appreciate anyone looking at this.</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Thanks,</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Bruce</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">--</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Bruce Elrick, Ph.D.</FONT>

<BR><FONT SIZE=2 FACE="Courier New">UNIX and Data Storage Specialist - IT</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Canexus</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Phone: 403-571-7376</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Cell: 403-870-4429</FONT>

<BR><FONT SIZE=2 FACE="Courier New">Email: Bruce.Elrick@canexus.ca</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">The only thing that sustains one through life is the consciousness of the immense inferiority of everybody else, and this is a feeling that I have always cultivated.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New"> -- Oscar Wilde</FONT>
</P>


<P><pre wrap>************************************************************
IMPORTANT NOTICE: This message is intended for the individual or entity to which it is addressed
and may contain information that is privileged, confidential, and/or exempt from disclosure under 
applicable law. If you are not the intended recipient, you are hereby notified that copying, 
forwarding or other dissemination or distribution of this message is prohibited and that taking 
any action in reliance on the content of this message is to be avoided. Should you receive this 
e-mail in error, please notify the sender immediately via e-mail or call (403) 699-4000 
and delete this message from your system. Thank you. 
************************************************************
</pre></P></BODY>
</HTML>