<!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>RE: Problem running Check_sap.pl under ePN</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">Bad form to reply to one's own email, but I continued digging. I stopped nagios and thus the full plugin dump file was written and now I see that the check script is wrapped in:</FONT></P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">Sub hndlr {</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">…</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">}</FONT>
</P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">And obviously the __END__ breaks that. Removing the line numbers and date stamp from the dump and adding a #! Line allows me to duplicate the Missing right curly error in a normal Perl environment outside ePN.</FONT></P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">I removed from the __END__ to the end of the script file (which just contained script version info in POD form) so that now the end of the script is its natural end of file instead of __END__. It now functions in the ePN environment as expected.</FONT></P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">I'll guess that since check_sap.pl was written the method of embedding a script in Nagios::Plugin and ePN changed?</FONT>
</P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">Thanks for you patience.</FONT>
</P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">Bruce</FONT>
</P>
<P><FONT FACE="Courier New">> </FONT> <FONT SIZE=1 FACE="Tahoma">-----Original Message-----</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">> From: </FONT></B> <FONT SIZE=1 FACE="Tahoma">Elrick, Bruce (Calgary) </FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">> Sent:</FONT></B> <FONT SIZE=1 FACE="Tahoma">Monday, October 30, 2006 3:05 PM</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">> To: </FONT></B> <FONT SIZE=1 FACE="Tahoma">'nagiosplug-help@lists.sourceforge.net'</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">> Subject: </FONT></B> <FONT SIZE=1 FACE="Tahoma">Problem running Check_sap.pl under ePN</FONT>
<BR><FONT SIZE=1 FACE="Tahoma">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Background:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><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 $ </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> / wob (downloaded from nagiosexchange.org)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><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 </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> --ashost=qr3-ci --sap-sysnr=02</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> CHECK_SAP OK - system qr3 available</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> But when run from the ePN with the nagios daemon I get the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> following error:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> **ePN failed to compile </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> /usr/local/bin/check_sap.pl: "Missing right curly or square </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> bracket at (eval 1) line 301, at end of line </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Clearly ePN is parsing the script differently from regular </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> perl. I know perl check script writers have to obey stricter </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> rules than regular perl scripts to function correctly in the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> ePN environment, but I am not the author of check_sap.pl and </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> clearly that person has had to deal with Nagios::Plugin </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> before so I thought it would make sense to appeal to the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> mailing list for help.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><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>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> I thought it maybe had to do with the PODification of the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> script but using Perl::Tidy to remove the documentation only </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> changes and moves the error.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> I've noted the warning about using Nagios::Plugin needing to </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> be above 0.12 on the nagiosexchange page for check_sap.pl. </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Although I understand that compiled nagios includes an </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> embedded perl engine and that it interprets perl check </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> scripts somehow using p1.pl and that the above error has to </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> do with how that mechanism is failing to load and compile the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> script, I certainly don't understand the details. Is there a </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> way to invoke a perl check script in an embedded perl </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> environment similar to how the nagios process does for the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> purposes of debugging?</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> I notice that /usr/sbin/p1.pl includes some debugging which I </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> 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 | </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> 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 </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> | CACHE_DUMP | PLUGIN_DUMP ;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> But his only seems to give me information I already had, that </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> 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 </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> /usr/local/bin/check_sap.pl: "Missing right curly or square </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> bracket at (eval 1) line 301, at end of line</FONT>
<BR><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: </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> /usr/local/bin/check_sap.pl failed compilation formerly and </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> file has not changed; skipping compilation.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> The plugin dump file has 3 x 4kB of the data and is clearly </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> check script prepended with the following:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><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 </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> # <<< START of PLUGIN (first line of plugin is line 8 in the</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> text) >>></FONT>
<BR><FONT SIZE=2 FACE="Courier New">> 8 #!/usr/bin/perl</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> And that doesn't help me understand how it is parsing the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> script differently.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Has anyone seen a problem like this before? I've looked for </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> obvious things like POD causing compilation to be different </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> but with no luck.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> I appreciate anyone looking at this.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Thanks,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> Bruce</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><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>
<BR><FONT SIZE=2 FACE="Courier New">> </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> The only thing that sustains one through life is the </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> consciousness of the immense inferiority of everybody else, </FONT>
<BR><FONT SIZE=2 FACE="Courier New">> and this is a feeling that I have always cultivated.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> -- Oscar Wilde</FONT>
<BR><FONT SIZE=2 FACE="Courier New">> </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>