Debian Codegraph @

utils/munin/mod_tile_zoom

raw
1 #!/bin/sh
2 #
3 # Plugin to monitor the response codes of tiles returned by mod_tile
4 #
5 # Parameters:
6 #
7 # config (required)
8 # autoconf (optional - used by munin-config)
9 #
10 # Copyright (c) 2007 - 2023 by mod_tile contributors (see AUTHORS file)
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; If not, see http://www.gnu.org/licenses/.
24
25 if [ "$1" = "config" ]; then
26
27 echo 'graph_title mod_tile responses by zoom layer'
28 echo 'graph_args --base 1000 -l 0'
29 echo 'graph_vlabel responses per ${graph_period}'
30 echo 'graph_category mod_tile'
31 echo 'z1.label z1-8'
32 echo 'z1.draw AREA'
33 echo 'z1.type DERIVE'
34 echo 'z1.min 0'
35 echo 'z2.label z9-12'
36 echo 'z2.draw STACK'
37 echo 'z2.type DERIVE'
38 echo 'z2.min 0'
39 echo 'z3.label z13-14'
40 echo 'z3.draw STACK'
41 echo 'z3.type DERIVE'
42 echo 'z3.min 0'
43 echo 'z4.label z15-16'
44 echo 'z4.draw STACK'
45 echo 'z4.type DERIVE'
46 echo 'z4.min 0'
47 echo 'z5.label z17-18'
48 echo 'z5.draw STACK'
49 echo 'z5.type DERIVE'
50 echo 'z5.min 0'
51 echo 'z6.label z19-20'
52 echo 'z6.draw STACK'
53 echo 'z6.type DERIVE'
54 echo 'z6.min 0'
55 exit 0
56 fi
57
58 data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)
59
60 resp_0=$(expr match "$data" '.*NoRespZoom00: \([0-9]*\)')
61 resp_1=$(expr match "$data" '.*NoRespZoom01: \([0-9]*\)')
62 resp_2=$(expr match "$data" '.*NoRespZoom02: \([0-9]*\)')
63 resp_3=$(expr match "$data" '.*NoRespZoom03: \([0-9]*\)')
64 resp_4=$(expr match "$data" '.*NoRespZoom04: \([0-9]*\)')
65 resp_5=$(expr match "$data" '.*NoRespZoom05: \([0-9]*\)')
66 resp_6=$(expr match "$data" '.*NoRespZoom06: \([0-9]*\)')
67 resp_7=$(expr match "$data" '.*NoRespZoom07: \([0-9]*\)')
68 resp_8=$(expr match "$data" '.*NoRespZoom08: \([0-9]*\)')
69 resp_9=$(expr match "$data" '.*NoRespZoom09: \([0-9]*\)')
70 resp_10=$(expr match "$data" '.*NoRespZoom10: \([0-9]*\)')
71 resp_11=$(expr match "$data" '.*NoRespZoom11: \([0-9]*\)')
72 resp_12=$(expr match "$data" '.*NoRespZoom12: \([0-9]*\)')
73 resp_13=$(expr match "$data" '.*NoRespZoom13: \([0-9]*\)')
74 resp_14=$(expr match "$data" '.*NoRespZoom14: \([0-9]*\)')
75 resp_15=$(expr match "$data" '.*NoRespZoom15: \([0-9]*\)')
76 resp_16=$(expr match "$data" '.*NoRespZoom16: \([0-9]*\)')
77 resp_17=$(expr match "$data" '.*NoRespZoom17: \([0-9]*\)')
78 resp_18=$(expr match "$data" '.*NoRespZoom18: \([0-9]*\)')
79 resp_19=$(expr match "$data" '.*NoRespZoom19: \([0-9]*\)')
80 resp_20=$(expr match "$data" '.*NoRespZoom20: \([0-9]*\)')
81
82 if [ -z "$resp_19" ]; then
83 resp_19=0
84 fi
85 if [ -z "$resp_20" ]; then
86 resp_20=0
87 fi
88
89 echo "z1.value " $(expr $resp_0 + $resp_1 + + $resp_2 + $resp_3 + $resp_4 + $resp_5 + $resp_6 + $resp_7 + $resp_8)
90 echo "z2.value " $(expr $resp_9 + $resp_10 + + $resp_11 + $resp_12)
91 echo "z3.value " $(expr $resp_13 + $resp_14)
92 echo "z4.value " $(expr $resp_15 + $resp_16)
93 echo "z5.value " $(expr $resp_17 + $resp_18)
94 echo "z6.value " $(expr $resp_19 + $resp_20)