File: mod_tile_zoom

package info (click to toggle)
libapache2-mod-tile 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,872 kB
  • sloc: cpp: 18,151; ansic: 7,574; sh: 980; makefile: 163; xml: 27
file content (94 lines) | stat: -rwxr-xr-x 3,374 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
#
# Plugin to monitor the response codes of tiles returned by mod_tile
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2023 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.

if [ "$1" = "config" ]; then

  echo 'graph_title mod_tile responses by zoom layer'
  echo 'graph_args --base 1000 -l 0'
  echo 'graph_vlabel responses per ${graph_period}'
  echo 'graph_category mod_tile'
  echo 'z1.label z1-8'
  echo 'z1.draw AREA'
  echo 'z1.type DERIVE'
  echo 'z1.min 0'
  echo 'z2.label z9-12'
  echo 'z2.draw STACK'
  echo 'z2.type DERIVE'
  echo 'z2.min 0'
  echo 'z3.label z13-14'
  echo 'z3.draw STACK'
  echo 'z3.type DERIVE'
  echo 'z3.min 0'
  echo 'z4.label z15-16'
  echo 'z4.draw STACK'
  echo 'z4.type DERIVE'
  echo 'z4.min 0'
  echo 'z5.label z17-18'
  echo 'z5.draw STACK'
  echo 'z5.type DERIVE'
  echo 'z5.min 0'
  echo 'z6.label z19-20'
  echo 'z6.draw STACK'
  echo 'z6.type DERIVE'
  echo 'z6.min 0'
  exit 0
fi

data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)

resp_0=$(expr match "$data" '.*NoRespZoom00: \([0-9]*\)')
resp_1=$(expr match "$data" '.*NoRespZoom01: \([0-9]*\)')
resp_2=$(expr match "$data" '.*NoRespZoom02: \([0-9]*\)')
resp_3=$(expr match "$data" '.*NoRespZoom03: \([0-9]*\)')
resp_4=$(expr match "$data" '.*NoRespZoom04: \([0-9]*\)')
resp_5=$(expr match "$data" '.*NoRespZoom05: \([0-9]*\)')
resp_6=$(expr match "$data" '.*NoRespZoom06: \([0-9]*\)')
resp_7=$(expr match "$data" '.*NoRespZoom07: \([0-9]*\)')
resp_8=$(expr match "$data" '.*NoRespZoom08: \([0-9]*\)')
resp_9=$(expr match "$data" '.*NoRespZoom09: \([0-9]*\)')
resp_10=$(expr match "$data" '.*NoRespZoom10: \([0-9]*\)')
resp_11=$(expr match "$data" '.*NoRespZoom11: \([0-9]*\)')
resp_12=$(expr match "$data" '.*NoRespZoom12: \([0-9]*\)')
resp_13=$(expr match "$data" '.*NoRespZoom13: \([0-9]*\)')
resp_14=$(expr match "$data" '.*NoRespZoom14: \([0-9]*\)')
resp_15=$(expr match "$data" '.*NoRespZoom15: \([0-9]*\)')
resp_16=$(expr match "$data" '.*NoRespZoom16: \([0-9]*\)')
resp_17=$(expr match "$data" '.*NoRespZoom17: \([0-9]*\)')
resp_18=$(expr match "$data" '.*NoRespZoom18: \([0-9]*\)')
resp_19=$(expr match "$data" '.*NoRespZoom19: \([0-9]*\)')
resp_20=$(expr match "$data" '.*NoRespZoom20: \([0-9]*\)')

if [ -z "$resp_19" ]; then
  resp_19=0
fi
if [ -z "$resp_20" ]; then
  resp_20=0
fi

echo "z1.value " $(expr $resp_0 + $resp_1 + + $resp_2 + $resp_3 + $resp_4 + $resp_5 + $resp_6 + $resp_7 + $resp_8)
echo "z2.value " $(expr $resp_9 + $resp_10 + + $resp_11 + $resp_12)
echo "z3.value " $(expr $resp_13 + $resp_14)
echo "z4.value " $(expr $resp_15 + $resp_16)
echo "z5.value " $(expr $resp_17 + $resp_18)
echo "z6.value " $(expr $resp_19 + $resp_20)