check_citrix help part II (Solution)

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Sep 18 03:59:37 CEST 2004


Dear Sir,

I am writing to thank you for your letter and say,

On Fri, Sep 17, 2004 at 02:53:00PM -0700, Dale Hobbs wrote:
> Ok so using a wrapper file help some. If you were to run
> /etc/local/nagios/libexec/check_citrix with no options you would get the
> following output
> 
> Can't locate utils.pm in @INC (@INC contains: /etc/perl
> /usr/lib/perl5/site_perl/5.8.4/i686-linux /usr/lib/perl5/site_perl/5.8.4
> /usr/lib/perl5/site_perl/5.8.2/i686-linux /usr/lib/perl5/site_perl/5.8.2
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.4/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.4
> /usr/lib/perl5/vendor_perl/5.8.2/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl
> /usr/lib/perl5/5.8.4/i686-linux /usr/lib/perl5/5.8.4
> /usr/local/lib/site_perl /usr/lib/perl5/site_perl/5.8.2/i686-linux
> /usr/lib/perl5/site_perl/5.8.2 .) at libexec/check_citrix line 33.
> BEGIN failed--compilation aborted at libexec/check_citrix line 33.
> 
> 
> Basically what this means is that Nagios is trying to run the
> check_citrix command from it's working directory but perl is looking for
> the utils.pm file in one of the directory's listed in the error above.
> So if you move the utils.pm file to any directory listed in the error
> (we moved it to /etc/perl, the directory didn't exist so we created it)
> then Nagios should successfully run the plugin.
> 

Yup. utils.pm is a frequent cause of problems with Perl plugins.

The paths above are those that Perl searches to find modules; in other 
words it searches each of them whenever an application 'requires' or 
'uses' a module.

Check_citrix 'uses' five modules; since most of these are standard (ship 
with Perl) they are already in the paths above. Since utils.pm is not a 
standard or a CPAN module it is not installed in one of those paths.

This is such a common problem that I would like to recap ways of dealing 
with it

1 Expect the user to deal with it by installing utils.pm in a Perl path 
(vi). In fact, this is the assumption made for _all_ required 
modules (Net::SNMP is another FAQ)

2 Ensure Perl plugins use the standard Perl pragma 'use lib <list of 
paths to search for modules>'. This allows utils.pm to be installed 
anywhere Nagios finds convenient and still be found.

check_citrix _fails_ to do this.

3 Ensure Perl plugins trap failure to load modules and write something 
meaningful to STDOUT (not STDERR)

4 Change Nagios to return the result of STDERR _as well as_ STDOUT when 
it runs a plugin.

I am not sure if Nag already does this but it seems not to. Doing so 
would present fragments of horrible error messages instead of '(No 
output!)'.

5 Make utils.pm a CPAN module (eg Nagios::utils) and require people 
install it (in conjunction with 3)

6 Adopt a Perl plugin framework that 'does it all for you'

(if you were using Nag 2.x, the embedded Perl support does a better job 
of trapping errors - if you had configured 2.x with embedded Perl 
support)

Lastly, the Perl directories are classified into (for each Perl version 
installed [ you have 2 of them])

Vendor Specific
  Architecture independent (ie Pure Perl)
  Arch dependendent

Standard (ship with Perl)
  Architecture independent (ie Pure Perl)
  Arch dependendent

Site specific (this machine only)
  Architecture independent (ie Pure Perl)
  Arch dependendent

In the list above those with i686-linux are arch dependent paths that 
normally constain XS (compiled) modules.

I would put your utils.pm in one of 

/usr/local/lib/site_perl (prob this one since it's version independent)
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.4

Thanks for your feedback and I am glad you got it sorted out.

Yours sincerely.


-- 
Stanley Hopcroft

Network specialist, IT Infrastructure
IP Australia
Ph: (02) 6283 3189  Fax: (02) 6281 1353
PO Box 200 Woden  ACT 2606
http://www.ipaustralia.gov.au


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list