[Nagiosplug-help] Problem running Check_sap.pl under ePN

Elrick, Bruce (Calgary) Bruce.Elrick at canexus.ca
Tue Oct 31 00:50:58 CET 2006


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:

Sub hndlr {
...
}

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.

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.

I'll guess that since check_sap.pl was written the method of embedding a
script in Nagios::Plugin and ePN changed?

Thanks for you patience.

Bruce

>  -----Original Message-----
> From: 	Elrick, Bruce (Calgary)  
> Sent:	Monday, October 30, 2006 3:05 PM
> To:	'nagiosplug-help at lists.sourceforge.net'
> Subject:	Problem running Check_sap.pl under ePN
> 
> Background:
> 
> OS Version:		Fedora Core release 5 (Bordeaux)
> Perl Version:	perl-5.8.8-5 (from FC 5)
> Nagios Version:	nagios-2.5-2.fc5 (from FC 5)
> 			nagios-devel-2.5-2.fc5 (from FC 5)
> Nagios::Plugin:	Nagios-Plugin-0.14.tar.gz (installed using CPAN)
> Check_sap.pl:	$Revision: 1.4 $ / $Date: 2006/10/14 08:38:18 $ 
> / wob (downloaded from nagiosexchange.org)
> 
> I can run the check from the nagios user's shell:
> [nagios at lutetia ~]$ /usr/local/bin/check_sap.pl 
> --ashost=qr3-ci --sap-sysnr=02
> CHECK_SAP OK - system qr3 available
> 
> But when run from the ePN with the nagios daemon I get the 
> following error:
> 		**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 
> 
> 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.
> 
> Line 301 is:
>     298    return $version;
>     299 }
>     300
>     301 __END__
>     302 # ===============================================
>     303
>     304 =head1 AUTHOR
>     305
> 
> 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.
> 
> I've noted the warning about using Nagios::Plugin needing to 
> be above 0.12 on the nagiosexchange page for check_sap.pl.  
> 
> 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?
> 
> I notice that /usr/sbin/p1.pl includes some debugging which I 
> turned on:
> diff /usr/sbin/p1.pl /usr/sbin/p1.pl.orig
> 14c14
> < #use constant DEBUG_LEVEL             => 0 ;
> ---
> > use constant  DEBUG_LEVEL             => 0 ;
> 18c18
> < use constant  DEBUG_LEVEL             => LEAVE_MSG | 
> CACHE_DUMP | PLUGIN_DUMP ;
> ---
> > # use constant        DEBUG_LEVEL             => LEAVE_MSG 
> | CACHE_DUMP | PLUGIN_DUMP ;
> 
> But his only seems to give me information I already had, that 
> it is having problems parsing the check script:
> [root at lutetia var]# head epn_leave-msgs.log
> 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
> syntax error at (eval 1) line 308, at EOF".
> 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.
> 
> The plugin dump file has 3 x 4kB of the data and is clearly 
> check script prepended with the following:
> 
>          1  package Embed::usr::local::bin::check_5fsap_2epl;
>          2
>          3  sub hndlr {
>          4      @ARGV = @_ ;
>          5      local $^W = 1 ;
>          6
>          7                                                    
>           # <<< START of PLUGIN (first line of plugin is line 8 in the
>  text) >>>
>          8  #!/usr/bin/perl
> 
> And that doesn't help me understand how it is parsing the 
> script differently.
> 
> 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.
> 
> I appreciate anyone looking at this.
> 
> Thanks,
> Bruce
> 
> --
> Bruce Elrick, Ph.D.
> UNIX and Data Storage Specialist - IT
> Canexus
> Phone: 403-571-7376
> Cell: 403-870-4429
> Email: Bruce.Elrick at canexus.ca
> 
> 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.
>  -- Oscar Wilde
> 

************************************************************
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. 
************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20061030/162b8c96/attachment.html>


More information about the Help mailing list