Debian Codegraph @

utils/munin/mod_tile_fresh

raw
1 #!/bin/sh
2 #
3 # Plugin to monitor the state / freshness of the 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 freshness of served tiles'
28 echo 'graph_args --base 1000 -l 0'
29 echo 'graph_vlabel tiles per ${graph_period}'
30 echo 'graph_category mod_tile'
31 echo 'fresh.label Fresh from disk'
32 echo 'fresh.draw AREA'
33 echo 'fresh.type DERIVE'
34 echo 'fresh.min 0'
35 echo 'freshrender.label Freshly rendered'
36 echo 'freshrender.draw STACK'
37 echo 'freshrender.type DERIVE'
38 echo 'freshrender.min 0'
39 echo 'old.label Old from disk'
40 echo 'old.draw STACK'
41 echo 'old.type DERIVE'
42 echo 'old.min 0'
43 echo 'oldrender.label Old tile, attempted render'
44 echo 'oldrender.draw STACK'
45 echo 'oldrender.type DERIVE'
46 echo 'oldrender.min 0'
47 echo 'outdated.label Outdated from disk'
48 echo 'outdated.draw STACK'
49 echo 'outdated.type DERIVE'
50 echo 'outdated.min 0'
51 echo 'outdatedrender.label Outdated tile, attempted render'
52 echo 'outdatedrender.draw STACK'
53 echo 'outdatedrender.type DERIVE'
54 echo 'outdatedrender.min 0'
55
56 exit 0
57 fi
58
59 data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)
60
61 fresh=$(expr match "$data" '.*NoFreshCache: \([0-9]*\)')
62 freshRender=$(expr match "$data" '.*NoFreshRender: \([0-9]*\)')
63 old=$(expr match "$data" '.*NoOldCache: \([0-9]*\)')
64 oldRender=$(expr match "$data" '.*NoOldRender: \([0-9]*\)')
65 outdated=$(expr match "$data" '.*NoVeryOldCache: \([0-9]*\)')
66 outdatedRender=$(expr match "$data" '.*NoVeryOldRender: \([0-9]*\)')
67
68 echo "fresh.value " $fresh
69 echo "freshrender.value " $freshRender
70 echo "old.value " $old
71 echo "oldrender.value " $oldRender
72 echo "outdated.value " $outdated
73 echo "outdatedrender.value " $outdatedRender