Created
August 28, 2011 02:07
-
-
Save andrewharvey/1176151 to your computer and use it in GitHub Desktop.
Munin Plugin to monitor the disk usage of a TileCache Disk Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a Munin plugin to report the disk usage of TileCache disk caches. | |
# Use it by linking with the name tilecache_cache_size_LAYERNAME | |
# The "standard" way to install this script for Munin is to place it in /usr/share/munin/plugins/ | |
# and then run (replacing LAYERNAME with the TileCache layer name as in tilecache.cfg) | |
# ln -s -T /usr/share/munin/plugins/tilecache_cache_size_ /etc/munin/plugins/tilecache_cache_size_LAYERNAME | |
# Author: Andrew Harvey <andrew.harvey4@gmail.com> | |
# License: CC0 http://creativecommons.org/publicdomain/zero/1.0/ | |
# | |
# To the extent possible under law, the person who associated CC0 | |
# with this work has waived all copyright and related or neighboring | |
# rights to this work. | |
# grab the TileCache layer from $0 as per Munin standard practice | |
layer=${0##*tilecache_cache_size_} | |
CACHE_DIR=/tmp/tilecache | |
case $1 in | |
config) | |
echo "graph_title TileCache $layer Cache Disk Usage" | |
cat <<'EOM' | |
graph_vlabel bytes | |
graph_category tilecache | |
graph_args --base 1024 -l 0 | |
EOM | |
for zoom in {00..19} ; do | |
echo "$layer-$zoom.label $layer $zoom" | |
echo "$layer-$zoom.draw AREASTACK" | |
done | |
echo "$layer-total.label $layer total" | |
exit 0;; | |
esac | |
# value for each zoom level | |
for zoom in {00..19} ; do | |
echo -n "$layer-$zoom.value " | |
if [ -e $CACHE_DIR/$layer/$zoom ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/$layer/$zoom/ | cut -f1 | |
else | |
echo "0" | |
fi | |
done | |
# total value | |
echo -n "$layer-total.value " | |
if [ -e $CACHE_DIR/$layer ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/$layer/ | cut -f1 | |
else | |
echo "0" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a Munin plugin to report the disk usage of TileStache disk caches. | |
# This script will report the total disk usage of each layer in the cache. | |
# The "standard" way to install this script for Munin is to place it in /usr/share/munin/plugins/ | |
# and then run | |
# ln -s -T /usr/share/munin/plugins/tilestache_cache_layer_sizes /etc/munin/plugins/tilestache_cache_layer_sizes | |
# Author: Andrew Harvey <andrew.harvey4@gmail.com> | |
# License: CC0 http://creativecommons.org/publicdomain/zero/1.0/ | |
# | |
# To the extent possible under law, the person who associated CC0 | |
# with this work has waived all copyright and related or neighboring | |
# rights to this work. | |
CACHE_DIR=/var/cache/tilestache | |
case $1 in | |
config) | |
echo "graph_title TileStache Cache Disk Usage per Layer" | |
cat <<'EOM' | |
graph_vlabel bytes | |
graph_category tilestache | |
graph_args --base 1024 -l 0 | |
EOM | |
for l in $CACHE_DIR/* ; do | |
layer=`basename $l` | |
echo "$layer.label $layer" | |
echo "$layer.draw AREASTACK" | |
done | |
echo "total.label $layer total" | |
exit 0;; | |
esac | |
# value for each zoom level | |
for l in $CACHE_DIR/* ; do | |
layer=`basename $l` | |
echo -n "$layer.value " | |
if [ -e $CACHE_DIR/$layer ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/$layer/ | cut -f1 | |
else | |
echo "0" | |
fi | |
done | |
# total value | |
echo -n "total.value " | |
if [ -e $CACHE_DIR/$layer ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/ | cut -f1 | |
else | |
echo "0" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a Munin plugin to report the disk usage of TileStache disk caches. | |
# This script will report size breakdown of each zoom level in a specified | |
# layers cache. | |
# Use it by linking with the name tilestache_cache_size_LAYERNAME | |
# The "standard" way to install this script for Munin is to place it in /usr/share/munin/plugins/ | |
# and then run (replacing LAYERNAME with the TileStache layer name as in tilestache.cfg) | |
# ln -s -T /usr/share/munin/plugins/tilestache_cache_size_ /etc/munin/plugins/tilestache_cache_size_LAYERNAME | |
# Author: Andrew Harvey <andrew.harvey4@gmail.com> | |
# License: CC0 http://creativecommons.org/publicdomain/zero/1.0/ | |
# | |
# To the extent possible under law, the person who associated CC0 | |
# with this work has waived all copyright and related or neighboring | |
# rights to this work. | |
# grab the TileStache layer from $0 as per Munin standard practice | |
layer=${0##*tilestache_cache_size_} | |
CACHE_DIR=/var/cache/tilestache | |
case $1 in | |
config) | |
echo "graph_title TileStache $layer Cache Disk Usage per Zoom" | |
cat <<'EOM' | |
graph_vlabel bytes | |
graph_category tilestache | |
graph_args --base 1024 -l 0 | |
EOM | |
for zoom in {00..19} ; do | |
echo "$layer-$zoom.label $layer $zoom" | |
echo "$layer-$zoom.draw AREASTACK" | |
done | |
echo "$layer-total.label $layer total" | |
exit 0;; | |
esac | |
# value for each zoom level | |
for zoom in {00..19} ; do | |
echo -n "$layer-$zoom.value " | |
if [ -e $CACHE_DIR/$layer/$zoom ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/$layer/$zoom/ | cut -f1 | |
else | |
echo "0" | |
fi | |
done | |
# total value | |
echo -n "$layer-total.value " | |
if [ -e $CACHE_DIR/$layer ] ; then | |
du --summarize --block-size=1 $CACHE_DIR/$layer/ | cut -f1 | |
else | |
echo "0" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment