1
Smokeping::matchers::base(3)SmokePingSmokeping::matchers::base(3)
1
Smokeping::matchers::base(3) SmokePing Smokeping::matchers::base(3)
6
Smokeping::matchers::base - Base Class for implementing
6
Smokeping::matchers::base - Base Class for implementing SmokePing
10
This is the base class for writing SmokePing matchers.
11
Every matcher must inherit from the base class and provide
12
it's own methods for the 'business' logic.
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
14
Note that the actual matchers must have at least one capi-
15
tal letter in their name, to differentiate them from the
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).
18
17
DDEESSCCRRIIPPTTIIOONN
19
18
Every matcher must provide the following methods:
23
22
The new method expects hash elements as an argument eg
24
new({x=>'\d+',y=>'\d+'},x=>1,y=>2). The first part is a
25
syntax rule for the arguments it should expect and the
26
second part are the arguments itself. The first part will
27
be supplied by the child class as it calls the parent
23
new({x=>'\d+',y=>'\d+'},x=>1,y=>2). The first part is a syntax rule for
24
the arguments it should expect and the second part are the arguments
25
itself. The first part will be supplied by the child class as it calls
32
The Length method returns the number of values the matcher
33
will expect from SmokePing. This method must be overridden
34
by the children of the base class.
30
The Length method returns the number of values the matcher will expect
31
from SmokePing. This method must be overridden by the children of the
38
Simply return the description of the function. This method
39
must be overwritten by a children of the base class.
36
Simply return the description of the function. This method must be
37
overwritten by a children of the base class.
43
Run the matcher and return true or false. The Test method
44
is called with a hash containing two arrays giving it
45
access to both rtt and loss values.
41
Run the matcher and return true or false. The Test method is called
42
with a hash containing two arrays giving it access to both rtt and loss
48
46
my @rtt = @{$data->{rtt}};
55
There may be more than the expected number of elements in
56
this array. Address them with $x[-1] to $x[-max].
53
There may be more than the expected number of elements in this array.
54
Address them with $x[-1] to $x[-max].
58
There's also a key called 'prevmatch' in the hash. It con-
59
tains the value returned by the previous call of the
60
'Test' method. This allows for somewhat more intelligent
61
alerting due to state awareness.
56
There's also a key called 'prevmatch' in the hash. It contains the
57
value returned by the previous call of the 'Test' method. This allows
58
for somewhat more intelligent alerting due to state awareness.
63
60
my $prevmatch = $data->{prevmatch};
66
Copyright (c) 2004 by OETIKER+PARTNER AG. All rights
63
Copyright (c) 2004 by OETIKER+PARTNER AG. All rights reserved.
70
This program is free software; you can redistribute it
71
and/or modify it under the terms of the GNU General Public
72
License as published by the Free Software Foundation;
73
either version 2 of the License, or (at your option) any
76
This program is distributed in the hope that it will be
77
useful, but WITHOUT ANY WARRANTY; without even the implied
78
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
79
PURPOSE. See the GNU General Public License for more
82
You should have received a copy of the GNU General Public
83
License along with this program; if not, write to the Free
84
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
66
This program is free software; you can redistribute it and/or modify it
67
under the terms of the GNU General Public License as published by the
68
Free Software Foundation; either version 2 of the License, or (at your
69
option) any later version.
71
This program is distributed in the hope that it will be useful, but
72
WITHOUT ANY WARRANTY; without even the implied warranty of MER-
73
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
74
Public License for more details.
76
You should have received a copy of the GNU General Public License along
77
with this program; if not, write to the Free Software Foundation, Inc.,
78
675 Mass Ave, Cambridge, MA 02139, USA.
88
81
Tobias Oetiker <tobi@oetiker.ch>
92
2.0.9 2006-07-14Smokeping::matchers::base(3)
85
2.3.6 2006-07-12 Smokeping::matchers::base(3)