1..::lib::Smokeping::matchers::base(3S)mokePi.n.g::lib::Smokeping::matchers::base(3)
2
3
4

NAME

6       Smokeping::matchers::base - Base Class for implementing SmokePing
7       Matchers
8

OVERVIEW

10       This is the base class for writing SmokePing matchers. Every matcher
11       must inherit from the base class and provide it's own methods for the
12       'business' logic.
13
14       Note that the actual matchers must have at least one capital letter in
15       their name, to differentiate them from the base class(es).
16

DESCRIPTION

18       Every matcher must provide the following methods:
19
20   new
21       The new method expects hash elements as an argument eg
22       new({x=>'\d+',y=>'\d+'},x=>1,y=>2). The first part is a syntax rule for
23       the arguments it should expect and the second part are the arguments
24       itself. The first part will be supplied by the child class as it calls
25       the parent method.
26
27   Length
28       The Length method returns the number of values the matcher will expect
29       from SmokePing. This method must be overridden by the children of the
30       base class.
31
32   Desc
33       Simply return the description of the function. This method must be
34       overwritten by a children of the base class.
35
36   Test
37       Run the matcher and return true or false. The Test method is called
38       with a hash containing two arrays giving it access to both rtt and loss
39       values.
40
41         my $data=shift;
42         my @rtt = @{$data->{rtt}};
43         my @loss = @{$data->{loss}};
44
45       The arrays are ordered from old to new.
46
47         @rdd[old..new]
48
49       There may be more than the expected number of elements in this array.
50       Address them with $x[-1] to $x[-max].
51
52       There's also a key called 'prevmatch' in the hash. It contains the
53       value returned by the previous call of the 'Test' method. This allows
54       for somewhat more intelligent alerting due to state awareness.
55
56         my $prevmatch = $data->{prevmatch};
57
59       Copyright (c) 2004 by OETIKER+PARTNER AG. All rights reserved.
60

LICENSE

62       This program is free software; you can redistribute it and/or modify it
63       under the terms of the GNU General Public License as published by the
64       Free Software Foundation; either version 2 of the License, or (at your
65       option) any later version.
66
67       This program is distributed in the hope that it will be useful, but
68       WITHOUT ANY WARRANTY; without even the implied warranty of
69       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
70       General Public License for more details.
71
72       You should have received a copy of the GNU General Public License along
73       with this program; if not, write to the Free Software Foundation, Inc.,
74       675 Mass Ave, Cambridge, MA 02139, USA.
75

AUTHOR

77       Tobias Oetiker <tobi@oetiker.ch>
78
79
80
812.8.2                             2022-01-.2.2::lib::Smokeping::matchers::base(3)
Impressum