[Nagiosplug-devel] ePN Regression testing of subset of Perl plugin-scripts from 1.4.0alpha1 tarball on SourceForge.

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Jan 31 08:05:05 CET 2004


Dear Gentlemen,

Part of the testing hacking for the forthcoming Nagios::Persistence CPAN
module (yes a 'module' for p1.pl seems the only way to maintain it) has
included running an ePN simulator against a subset of the Perl plugins
from the forthcoming release.

You can see the results below, as well as the driver script (eventually
to be part of the module).

My analysis is

1 Successfull ePN plugins are 

  check_mailq
  check_ntp

2 Unsuccessfull ePN plugins are

  check_disk_smb

3 Dubious => simulation is inaccurate

 check_rpc

Notes.

check_disk_smb fails because it uses 'shift' as Perl vernacular for
'shift @ARGV'.

This does not work in an ePN since the plugin is turned into a
subroutine and therefore Perl interprets 'shift' as 'shift @_'.

I don't know why check_rpc fails after the first attempt. This is
usually an indication of name space pollution by either globals/use vars
or a closure effect. 

If you want to try this yourselves, hopefully with the other plugins,
then you need p1.pl from the Nag HEAD branch (p1.pl is still volatile
but the focus is on POD not internals).

Since this code is all in .pl land you can enjoy using a nice debugger
to find out why check_rpc is behaving so unreasonably. I hope to pursue
this (The C mini_epn is still being maintained but this more fun).

WARNING WARNING WARNING !

Attempting to run the driver/simulator below with a p1.pl from Nagios
1.x will only result in unhappiness since the plugin output will _not_
be returned to the driver.

Yours sincerely. 

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


1 Results of repeated ePN run attempts of plugin subset (I am hooked on
an old version of Net::SNMP because I run 5.005_03 so updating is not
possible until Net::SNMP accomodates venerable P5 installations).

tsitc> ./drive_epn_loop.pl 
check_rpc       (0, OK: RPC program portmapper version 2 udp running).
check_ntp       (0, NTP OK: Offset -0.000001 secs, jitter 0.433 msec,
peer is stratum 1).
check_disk_smb  (3, Invalid warning threshold: -H).
check_mailq     (0, OK: mailq is empty|unsent=0;5;10;0).

check_rpc       (3, UNKNOWN: RPC program portmapper  udp is not
running).
check_ntp       (0, NTP OK: Offset -0.000002 secs, jitter 0.433 msec,
peer is stratum 1).
check_disk_smb  (3, Invalid warning threshold: -H).
check_mailq     (0, OK: mailq is empty|unsent=0;5;10;0).

check_rpc       (3, UNKNOWN: RPC program portmapper  udp is not
running).
check_ntp       (0, NTP OK: Offset -0.000001 secs, jitter 0.433 msec,
peer is stratum 1).
check_disk_smb  (3, Invalid warning threshold: -H).
check_mailq     (0, OK: mailq is empty|unsent=0;5;10;0).

check_rpc       (3, UNKNOWN: RPC program portmapper  udp is not
running).
check_ntp       (0, NTP OK: Offset -0.000001 secs, jitter 0.433 msec,
peer is stratum 1).
check_disk_smb  (3, Invalid warning threshold: -H).
check_mailq     (0, OK: mailq is empty|unsent=0;5;10;0).
^C
tsitc> 

2 Driver code. Note that p1.pl must be in the same path as this code and
the plugins (although you can put in a plugin path if you want to)

#!/usr/bin/perl

# NB -w| $^W = 1 makes _every_ standard plugin fail (variable
# $PROGNAME will not stay shared).

# $Id$

# $Log$

use strict ;

require 'p1.pl' ;

my @cmdlines = <DATA> ;

while (1) {
  foreach my $cmd_line (@cmdlines) {
    chomp($cmd_line) ;
    my ($plugin_file, $argv) = split(/\s+/, $cmd_line, 2) ;
    eval {
  
      # 'eval {}' simulates the G_EVAL flag to perl_call_argv('code',
'flags')
      # Otherwise, die in 'eval_file' will end the caller also.
  
      Embed::Persistent::eval_file($plugin_file, 0) ;
  
    } ;
  
    # don't care about $@ since it will be passed by eval_file to
run_package
  
    my ($rc, $output) = Embed::Persistent::run_package($plugin_file, 0,
'', $argv) ;
    chomp $output ;  
    print $plugin_file, "\t($rc, $output).\n" ;
    sleep 5 ;
  }
} 

exit 0 ;

__DATA__
check_rpc -H localhost -C portmapper
check_ntp -H localhost
check_disk_smb -H cbrnas01 -s anwsmh$ -u anwsmh -p Fgsltwhg6 -W
ipaustralia
check_mailq -w 5 -c 10





More information about the Devel mailing list