<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tao Yaoning wrote:<br>
<blockquote  cite="mid8ee7548c0510120952h67d4583aw26e8c38d79b2c866@mail.gmail.com"  type="cite">Hi, all<br>
  <br>
I use nagios 1.x to monitor my network, it works greatly. Now I want to
upgrade nagios to 2.0b4. So I just set up a new nagios server with
nagios 2.0b4 package, and copy all configuration files from old nagios
server to new server and edit all configuration files to make them have
correct syntax for nagios 2.<br>
  <br>
Every thing is fine except one problem.<br>
  <br>
I use check_snmp_apcups plugin to monitor my ups. It works very fine in
nagios 1.x, but in nagios 2.0b4, it always tell me an error "**ePN
failed to compile /usr/lib/nagios/plugins/check_snmp_apcups: "Global
symbol "$script" requires explicit package name at (eval 5) line
23,Global symbol "$script_version" requires explicit package name at
(eval 5) line 31." I checked the file, it's OK, it looks like this <br>
$script     = "check_snmp_apcups";<br>
$script_version = "2.1.0";<br>
and these global symbol are useless in the check_snmp_apcups. The
script only call them when display the help messages.<br>
</blockquote>
<br>
Is this your own Perl script?<br>
Does this perl script use warnings, and load the 'strict' module?<br>
ie:<br>
<br>
#!/usr/bin/perl <b>-w</b><br>
<b>use strict;</b><br>
..rest of script..<br>
<br>
I suspect that you have not enabled Strict mode in your script, and
have not given the -w (warning) flag to perl..<br>
<br>
What if you run 'perl -w -c <scriptname>' does it warn you about
the same errors?<br>
<br>
You should be defining your variables with 'my' or 'our' functions at
the beginning of your script.<br>
<br>
The embedded perl interpereter in Nagios probably is using the good
coding practices of using warnings and strict code checking, which is
why you are seeing these errors.<br>
<br>
Review your script, change the lines<br>
<br>
$script     = "check_snmp_apcups";<br>
$script_version = "2.1.0";<br>
<br>
to <br>
<br>
<b>my </b>$script     = "check_snmp_apcups";<br>
<b>my </b>$script_version = "2.1.0";<br>
<br>
And all subsequent variables, and you shouldn't receive any warnings. 
The warnings are telling you that you aren't defining your variables. 
Define the variables and there will be no warnings.<br>
<br>
Cheers<br>
rob<br>
<br>
</body>
</html>