| 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 HTTP response codes' |
| 28 |
echo 'graph_args --base 1000 -l 0' |
| 29 |
echo 'graph_vlabel responses per ${graph_period}' |
| 30 |
echo 'graph_category mod_tile' |
| 31 |
echo 'response200.label 200 OK' |
| 32 |
echo 'response200.draw AREA' |
| 33 |
echo 'response200.type DERIVE' |
| 34 |
echo 'response200.min 0' |
| 35 |
echo 'response304.label 304 Not Modified' |
| 36 |
echo 'response304.draw STACK' |
| 37 |
echo 'response304.type DERIVE' |
| 38 |
echo 'response304.min 0' |
| 39 |
echo 'response404.label 404 Not Found' |
| 40 |
echo 'response404.draw STACK' |
| 41 |
echo 'response404.type DERIVE' |
| 42 |
echo 'response404.min 0' |
| 43 |
echo 'response500.label 500 Internal Error' |
| 44 |
echo 'response500.draw STACK' |
| 45 |
echo 'response500.type DERIVE' |
| 46 |
echo 'response500.min 0' |
| 47 |
|
| 48 |
exit 0 |
| 49 |
fi |
| 50 |
|
| 51 |
data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -) |
| 52 |
|
| 53 |
ok_resp=$(expr match "$data" '.*NoResp200: \([0-9]*\)') |
| 54 |
nm_resp=$(expr match "$data" '.*NoResp304: \([0-9]*\)') |
| 55 |
fnf_resp=$(expr match "$data" '.*NoResp404: \([0-9]*\)') |
| 56 |
error_resp=$(expr match "$data" '.*NoResp5XX: \([0-9]*\)') |
| 57 |
|
| 58 |
echo "response200.value " $ok_resp |
| 59 |
echo "response304.value " $nm_resp |
| 60 |
echo "response404.value " $fnf_resp |
| 61 |
echo "response500.value " $error_resp |