source: subversion/applications/utils/mod_tile/mod_tile_latency @ 29283

Last change on this file since 29283 was 29195, checked in by apmon, 7 years ago

[mod_tile] log and graph time to retrieve tiles from disk

Adds a munin graph to monitor the average time it takes to retrieve a served tile
from disk. This can be useful to check if the underlying disk system is fast enough
to handle the load of serving tiles. It does not include time required for pontential
rendering on the fly, nor the time to deliver the tile over the network.

File size: 1.2 KB
Line 
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
11if [ "$1" = "config" ]; then
12
13        echo 'graph_title latency of tile retrival from disk'
14        echo 'graph_args --base 1000 -l 0'
15        echo 'graph_vlabel latency in ms'
16        echo 'graph_category mod_tile'
17        echo 'total.label All served tiles'
18        echo 'total.draw LINE2'
19        echo 'total.type GAUGE'
20        echo 'total.min 0'
21
22        exit 0
23fi
24
25#MUNIN_STATEFILE=latency.state
26
27data=`wget -q http://localhost/mod_tile -O -`
28
29
30totalDuration=`expr match "$data" '.*DurationTileBufferReads: \([0-9]*\)'`
31noTotal=`expr match "$data" '.*NoTileBufferReads: \([0-9]*\)'`
32totalDurationPrev=`sed -e '/^DurationTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
33noTotalPrev=`sed -e '/^NoTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
34
35echo "DurationTileBufferReads: $totalDuration" > $MUNIN_STATEFILE
36echo "NoTileBufferReads: $noTotal" >> $MUNIN_STATEFILE
37
38
39if [ "$noTotal" = "$noTotalPrev" ];
40then
41    totalLatency=0
42else
43    totalLatency=$(echo "$totalDuration $totalDurationPrev $noTotal $noTotalPrev" | awk '{ totalLat = ($1 - $2) / ($3 - $4) / 1000.0; print totalLat}' )
44fi
45
46echo "total.value " $totalLatency
Note: See TracBrowser for help on using the repository browser.