1..::lib::Smokeping::sorters::base(3)SmokePin.g.::lib::Smokeping::sorters::base(3)
2
3
4
6 Smokeping::sorters::base - Base Class for implementing SmokePing
7 Sorters
8
10 Sorters are at the core of the SmokePing Charts feature, where the most
11 interesting graphs are presented on a single page. The Sorter decides
12 which graphs are considerd interesting.
13
14 Every sorter must inherit from the base class and provide it's own
15 methods for the 'business' logic.
16
17 In order to maintain a decent performance the sorters activity is split
18 into two parts.
19
20 The first part is active while the smokeping daemon gathers its data.
21 Whenever data is received, the sorter is called to calculate a 'value'
22 for the present data. On every 'query round' this information is stored
23 in the sorter store directory. Each smokeping process stores it's own
24 information. Since smokeping can run in multiple instances at the same
25 time, the data may be split over several files
26
27 The second part of the sorter is called from smokeping.cgi. It loads
28 all the information from the sorter store and integrates it into a
29 single 'tree'. It then calls each sorter with the pre-calculated data
30 to get it sorted and to and to select the interesting information.
31
33 Every sorter must provide the following methods:
34
35 new
36 The new method expects hash elements as an argument eg
37 new({x=>'\d+',y=>'\d+'},x=>1,y=>2). The first part is a syntax rule for
38 the arguments it should expect and the second part are the arguments
39 itself. The first part will be supplied by the child class as it calls
40 the parent method.
41
42 Desc
43 Simply return the description of the function. This method must be
44 overwritten by a children of the base class.
45
46 SortTree
47 Returns an array of 'targets'. It is up to the sorter to decide how
48 many entries the list should contain. If the list is empty, the whole
49 entry will be supressed in the webfrontend.
50
51 The methode gets access to all the targets in the system, together with
52 the last data set acquired for each target.
53
54 CalcValues
55 Figure out the curent sorting value using te following input.
56
57 $info = { uptime => w,
58 loss => x,
59 median => y,
60 alert => z, # (0/1)
61 pings => [qw(a b c d)] }
62
63 The output can have any structure you want. It will be returned to the
64 sorter method for further processng.
65
67 Copyright (c) 2007 by OETIKER+PARTNER AG. All rights reserved.
68
70 This program is free software; you can redistribute it and/or modify it
71 under the terms of the GNU General Public License as published by the
72 Free Software Foundation; either version 2 of the License, or (at your
73 option) any later version.
74
75 This program is distributed in the hope that it will be useful, but
76 WITHOUT ANY WARRANTY; without even the implied warranty of
77 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
78 General Public License for more details.
79
80 You should have received a copy of the GNU General Public License along
81 with this program; if not, write to the Free Software Foundation, Inc.,
82 675 Mass Ave, Cambridge, MA 02139, USA.
83
85 Tobias Oetiker <tobi@oetiker.ch>
86
87
88
892.7.3 2021-07-2.3.::lib::Smokeping::sorters::base(3)