Applied shell code formatting

This commit is contained in:
Felix Delattre
2021-02-15 18:45:03 +00:00
parent 22d4cc1335
commit 8f1f3ad5ff
14 changed files with 803 additions and 844 deletions

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the state / freshness of the tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the state / freshness of the tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title freshness of served tiles'
@ -57,15 +56,14 @@ if [ "$1" = "config" ]; then
exit 0
fi
data=`wget -q http://localhost/mod_tile -O -`
fresh=`expr match "$data" '.*NoFreshCache: \([0-9]*\)'`
freshRender=`expr match "$data" '.*NoFreshRender: \([0-9]*\)'`
old=`expr match "$data" '.*NoOldCache: \([0-9]*\)'`
oldRender=`expr match "$data" '.*NoOldRender: \([0-9]*\)'`
outdated=`expr match "$data" '.*NoVeryOldCache: \([0-9]*\)'`
outdatedRender=`expr match "$data" '.*NoVeryOldRender: \([0-9]*\)'`
data=$(wget -q http://localhost/mod_tile -O -)
fresh=$(expr match "$data" '.*NoFreshCache: \([0-9]*\)')
freshRender=$(expr match "$data" '.*NoFreshRender: \([0-9]*\)')
old=$(expr match "$data" '.*NoOldCache: \([0-9]*\)')
oldRender=$(expr match "$data" '.*NoOldRender: \([0-9]*\)')
outdated=$(expr match "$data" '.*NoVeryOldCache: \([0-9]*\)')
outdatedRender=$(expr match "$data" '.*NoVeryOldRender: \([0-9]*\)')
echo "fresh.value " $fresh
echo "freshrender.value " $freshRender

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the state / freshness of the tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the state / freshness of the tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title avg latency of tile retrival from disk'
@ -63,154 +62,144 @@ fi
#MUNIN_STATEFILE=latency.state
data=`wget -q http://localhost/mod_tile -O -`
data=$(wget -q http://localhost/mod_tile -O -)
totalDuration=$(expr match "$data" '.*DurationTileBufferReads: \([0-9]*\)')
noTotal=$(expr match "$data" '.*NoTileBufferReads: \([0-9]*\)')
totalDurationPrev=$(sed -e '/^DurationTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
noTotalPrev=$(sed -e '/^NoTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
totalDuration=`expr match "$data" '.*DurationTileBufferReads: \([0-9]*\)'`
noTotal=`expr match "$data" '.*NoTileBufferReads: \([0-9]*\)'`
totalDurationPrev=`sed -e '/^DurationTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
noTotalPrev=`sed -e '/^NoTileBufferReads/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
z0Duration=$(expr match "$data" '.*DurationTileBufferReadZoom00: \([0-9]*\)')
z1Duration=$(expr match "$data" '.*DurationTileBufferReadZoom01: \([0-9]*\)')
z2Duration=$(expr match "$data" '.*DurationTileBufferReadZoom02: \([0-9]*\)')
z3Duration=$(expr match "$data" '.*DurationTileBufferReadZoom03: \([0-9]*\)')
z4Duration=$(expr match "$data" '.*DurationTileBufferReadZoom04: \([0-9]*\)')
z5Duration=$(expr match "$data" '.*DurationTileBufferReadZoom05: \([0-9]*\)')
z6Duration=$(expr match "$data" '.*DurationTileBufferReadZoom06: \([0-9]*\)')
z7Duration=$(expr match "$data" '.*DurationTileBufferReadZoom07: \([0-9]*\)')
z8Duration=$(expr match "$data" '.*DurationTileBufferReadZoom08: \([0-9]*\)')
z9Duration=$(expr match "$data" '.*DurationTileBufferReadZoom09: \([0-9]*\)')
z10Duration=$(expr match "$data" '.*DurationTileBufferReadZoom10: \([0-9]*\)')
z11Duration=$(expr match "$data" '.*DurationTileBufferReadZoom11: \([0-9]*\)')
z12Duration=$(expr match "$data" '.*DurationTileBufferReadZoom12: \([0-9]*\)')
z13Duration=$(expr match "$data" '.*DurationTileBufferReadZoom13: \([0-9]*\)')
z14Duration=$(expr match "$data" '.*DurationTileBufferReadZoom14: \([0-9]*\)')
z15Duration=$(expr match "$data" '.*DurationTileBufferReadZoom15: \([0-9]*\)')
z16Duration=$(expr match "$data" '.*DurationTileBufferReadZoom16: \([0-9]*\)')
z17Duration=$(expr match "$data" '.*DurationTileBufferReadZoom17: \([0-9]*\)')
z18Duration=$(expr match "$data" '.*DurationTileBufferReadZoom18: \([0-9]*\)')
z19Duration=$(expr match "$data" '.*DurationTileBufferReadZoom19: \([0-9]*\)')
z20Duration=$(expr match "$data" '.*DurationTileBufferReadZoom20: \([0-9]*\)')
z0Duration=`expr match "$data" '.*DurationTileBufferReadZoom00: \([0-9]*\)'`
z1Duration=`expr match "$data" '.*DurationTileBufferReadZoom01: \([0-9]*\)'`
z2Duration=`expr match "$data" '.*DurationTileBufferReadZoom02: \([0-9]*\)'`
z3Duration=`expr match "$data" '.*DurationTileBufferReadZoom03: \([0-9]*\)'`
z4Duration=`expr match "$data" '.*DurationTileBufferReadZoom04: \([0-9]*\)'`
z5Duration=`expr match "$data" '.*DurationTileBufferReadZoom05: \([0-9]*\)'`
z6Duration=`expr match "$data" '.*DurationTileBufferReadZoom06: \([0-9]*\)'`
z7Duration=`expr match "$data" '.*DurationTileBufferReadZoom07: \([0-9]*\)'`
z8Duration=`expr match "$data" '.*DurationTileBufferReadZoom08: \([0-9]*\)'`
z9Duration=`expr match "$data" '.*DurationTileBufferReadZoom09: \([0-9]*\)'`
z10Duration=`expr match "$data" '.*DurationTileBufferReadZoom10: \([0-9]*\)'`
z11Duration=`expr match "$data" '.*DurationTileBufferReadZoom11: \([0-9]*\)'`
z12Duration=`expr match "$data" '.*DurationTileBufferReadZoom12: \([0-9]*\)'`
z13Duration=`expr match "$data" '.*DurationTileBufferReadZoom13: \([0-9]*\)'`
z14Duration=`expr match "$data" '.*DurationTileBufferReadZoom14: \([0-9]*\)'`
z15Duration=`expr match "$data" '.*DurationTileBufferReadZoom15: \([0-9]*\)'`
z16Duration=`expr match "$data" '.*DurationTileBufferReadZoom16: \([0-9]*\)'`
z17Duration=`expr match "$data" '.*DurationTileBufferReadZoom17: \([0-9]*\)'`
z18Duration=`expr match "$data" '.*DurationTileBufferReadZoom18: \([0-9]*\)'`
z19Duration=`expr match "$data" '.*DurationTileBufferReadZoom19: \([0-9]*\)'`
z20Duration=`expr match "$data" '.*DurationTileBufferReadZoom20: \([0-9]*\)'`
if [ -z "$z19Duration" ]; then z19Duration=0; fi
if [ -z "$z20Duration" ]; then z20Duration=0; fi
if [ -z "$z19Duration" ]; then z19Duration=0; fi;
if [ -z "$z20Duration" ]; then z20Duration=0; fi;
z0NoServed=$(expr match "$data" '.*NoTileBufferReadZoom00: \([0-9]*\)')
z1NoServed=$(expr match "$data" '.*NoTileBufferReadZoom01: \([0-9]*\)')
z2NoServed=$(expr match "$data" '.*NoTileBufferReadZoom02: \([0-9]*\)')
z3NoServed=$(expr match "$data" '.*NoTileBufferReadZoom03: \([0-9]*\)')
z4NoServed=$(expr match "$data" '.*NoTileBufferReadZoom04: \([0-9]*\)')
z5NoServed=$(expr match "$data" '.*NoTileBufferReadZoom05: \([0-9]*\)')
z6NoServed=$(expr match "$data" '.*NoTileBufferReadZoom06: \([0-9]*\)')
z7NoServed=$(expr match "$data" '.*NoTileBufferReadZoom07: \([0-9]*\)')
z8NoServed=$(expr match "$data" '.*NoTileBufferReadZoom08: \([0-9]*\)')
z9NoServed=$(expr match "$data" '.*NoTileBufferReadZoom09: \([0-9]*\)')
z10NoServed=$(expr match "$data" '.*NoTileBufferReadZoom10: \([0-9]*\)')
z11NoServed=$(expr match "$data" '.*NoTileBufferReadZoom11: \([0-9]*\)')
z12NoServed=$(expr match "$data" '.*NoTileBufferReadZoom12: \([0-9]*\)')
z13NoServed=$(expr match "$data" '.*NoTileBufferReadZoom13: \([0-9]*\)')
z14NoServed=$(expr match "$data" '.*NoTileBufferReadZoom14: \([0-9]*\)')
z15NoServed=$(expr match "$data" '.*NoTileBufferReadZoom15: \([0-9]*\)')
z16NoServed=$(expr match "$data" '.*NoTileBufferReadZoom16: \([0-9]*\)')
z17NoServed=$(expr match "$data" '.*NoTileBufferReadZoom17: \([0-9]*\)')
z18NoServed=$(expr match "$data" '.*NoTileBufferReadZoom18: \([0-9]*\)')
z19NoServed=$(expr match "$data" '.*NoTileBufferReadZoom19: \([0-9]*\)')
z20NoServed=$(expr match "$data" '.*NoTileBufferReadZoom20: \([0-9]*\)')
z0NoServed=`expr match "$data" '.*NoTileBufferReadZoom00: \([0-9]*\)'`
z1NoServed=`expr match "$data" '.*NoTileBufferReadZoom01: \([0-9]*\)'`
z2NoServed=`expr match "$data" '.*NoTileBufferReadZoom02: \([0-9]*\)'`
z3NoServed=`expr match "$data" '.*NoTileBufferReadZoom03: \([0-9]*\)'`
z4NoServed=`expr match "$data" '.*NoTileBufferReadZoom04: \([0-9]*\)'`
z5NoServed=`expr match "$data" '.*NoTileBufferReadZoom05: \([0-9]*\)'`
z6NoServed=`expr match "$data" '.*NoTileBufferReadZoom06: \([0-9]*\)'`
z7NoServed=`expr match "$data" '.*NoTileBufferReadZoom07: \([0-9]*\)'`
z8NoServed=`expr match "$data" '.*NoTileBufferReadZoom08: \([0-9]*\)'`
z9NoServed=`expr match "$data" '.*NoTileBufferReadZoom09: \([0-9]*\)'`
z10NoServed=`expr match "$data" '.*NoTileBufferReadZoom10: \([0-9]*\)'`
z11NoServed=`expr match "$data" '.*NoTileBufferReadZoom11: \([0-9]*\)'`
z12NoServed=`expr match "$data" '.*NoTileBufferReadZoom12: \([0-9]*\)'`
z13NoServed=`expr match "$data" '.*NoTileBufferReadZoom13: \([0-9]*\)'`
z14NoServed=`expr match "$data" '.*NoTileBufferReadZoom14: \([0-9]*\)'`
z15NoServed=`expr match "$data" '.*NoTileBufferReadZoom15: \([0-9]*\)'`
z16NoServed=`expr match "$data" '.*NoTileBufferReadZoom16: \([0-9]*\)'`
z17NoServed=`expr match "$data" '.*NoTileBufferReadZoom17: \([0-9]*\)'`
z18NoServed=`expr match "$data" '.*NoTileBufferReadZoom18: \([0-9]*\)'`
z19NoServed=`expr match "$data" '.*NoTileBufferReadZoom19: \([0-9]*\)'`
z20NoServed=`expr match "$data" '.*NoTileBufferReadZoom20: \([0-9]*\)'`
if [ -z "$z19NoServed" ]; then z19NoServed=0; fi
if [ -z "$z20NoServed" ]; then z20NoServed=0; fi
if [ -z "$z19NoServed" ]; then z19NoServed=0; fi;
if [ -z "$z20NoServed" ]; then z20NoServed=0; fi;
zl1Duration=$(expr $z0Duration + $z1Duration + $z2Duration + $z3Duration + $z4Duration + $z5Duration + $z6Duration + $z7Duration + $z8Duration)
zl1NoServed=$(expr $z0NoServed + $z1NoServed + $z2NoServed + $z3NoServed + $z4NoServed + $z5NoServed + $z6NoServed + $z7NoServed + $z8NoServed)
zl2Duration=$(expr $z9Duration + $z10Duration + $z11Duration + $z12Duration)
zl2NoServed=$(expr $z9NoServed + $z10NoServed + $z11NoServed + $z12NoServed)
zl3Duration=$(expr $z13Duration + $z14Duration)
zl3NoServed=$(expr $z13NoServed + $z14NoServed)
zl4Duration=$(expr $z15Duration + $z16Duration)
zl4NoServed=$(expr $z15NoServed + $z16NoServed)
zl5Duration=$(expr $z17Duration + $z18Duration)
zl5NoServed=$(expr $z17NoServed + $z18NoServed)
zl6Duration=$(expr $z19Duration + $z20Duration)
zl6NoServed=$(expr $z19NoServed + $z20NoServed)
zl1Duration=`expr $z0Duration + $z1Duration + $z2Duration + $z3Duration + $z4Duration + $z5Duration + $z6Duration + $z7Duration + $z8Duration`
zl1NoServed=`expr $z0NoServed + $z1NoServed + $z2NoServed + $z3NoServed + $z4NoServed + $z5NoServed + $z6NoServed + $z7NoServed + $z8NoServed`
zl2Duration=`expr $z9Duration + $z10Duration + $z11Duration + $z12Duration`
zl2NoServed=`expr $z9NoServed + $z10NoServed + $z11NoServed + $z12NoServed`
zl3Duration=`expr $z13Duration + $z14Duration`
zl3NoServed=`expr $z13NoServed + $z14NoServed`
zl4Duration=`expr $z15Duration + $z16Duration`
zl4NoServed=`expr $z15NoServed + $z16NoServed`
zl5Duration=`expr $z17Duration + $z18Duration`
zl5NoServed=`expr $z17NoServed + $z18NoServed`
zl6Duration=`expr $z19Duration + $z20Duration`
zl6NoServed=`expr $z19NoServed + $z20NoServed`
zl1DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup1/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl1NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup1/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl2DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup2/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl2NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup2/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl3DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup3/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl3NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup3/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl4DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup4/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl4NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup4/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl5DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup5/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl5NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup5/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl6DurationPrev=$(sed -e '/^DurationTileBufferReadZoomGroup6/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl6NoServedPrev=$(sed -e '/^NoTileBufferReadZoomGroup6/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE)
zl1DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup1/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl1NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup1/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl2DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup2/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl2NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup2/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl3DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup3/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl3NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup3/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl4DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup4/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl4NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup4/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl5DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup5/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl5NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup5/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl6DurationPrev=`sed -e '/^DurationTileBufferReadZoomGroup6/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
zl6NoServedPrev=`sed -e '/^NoTileBufferReadZoomGroup6/!d' -e 's/.*: //' -e q $MUNIN_STATEFILE`
echo "DurationTileBufferReads: $totalDuration" >$MUNIN_STATEFILE
echo "NoTileBufferReads: $noTotal" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup1: $zl1Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup1: $zl1NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup2: $zl2Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup2: $zl2NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup3: $zl3Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup3: $zl3NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup4: $zl4Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup4: $zl4NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup5: $zl5Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup5: $zl5NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup6: $zl6Duration" >>$MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup6: $zl6NoServed" >>$MUNIN_STATEFILE
echo "DurationTileBufferReads: $totalDuration" > $MUNIN_STATEFILE
echo "NoTileBufferReads: $noTotal" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup1: $zl1Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup1: $zl1NoServed" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup2: $zl2Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup2: $zl2NoServed" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup3: $zl3Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup3: $zl3NoServed" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup4: $zl4Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup4: $zl4NoServed" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup5: $zl5Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup5: $zl5NoServed" >> $MUNIN_STATEFILE
echo "DurationTileBufferReadZoomGroup6: $zl6Duration" >> $MUNIN_STATEFILE
echo "NoTileBufferReadZoomGroup6: $zl6NoServed" >> $MUNIN_STATEFILE
if [ "$noTotal" = "$noTotalPrev" ];
then
if [ "$noTotal" = "$noTotalPrev" ]; then
totalLatency=0
else
totalLatency=$(echo "$totalDuration $totalDurationPrev $noTotal $noTotalPrev" | awk '{ totalLat = ($1 - $2) / ($3 - $4) / 1000000.0; print totalLat}' )
totalLatency=$(echo "$totalDuration $totalDurationPrev $noTotal $noTotalPrev" | awk '{ totalLat = ($1 - $2) / ($3 - $4) / 1000000.0; print totalLat}')
fi
if [ "$zl1NoServed" = "$zl1NoServedPrev" ];
then
if [ "$zl1NoServed" = "$zl1NoServedPrev" ]; then
zl1Latency=0
else
zl1Latency=$(echo "$zl1Duration $zl1DurationPrev $zl1NoServed $zl1NoServedPrev" | awk '{ zl1Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl1Lat}' )
zl1Latency=$(echo "$zl1Duration $zl1DurationPrev $zl1NoServed $zl1NoServedPrev" | awk '{ zl1Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl1Lat}')
fi
if [ "$zl2NoServed" = "$zl2NoServedPrev" ];
then
if [ "$zl2NoServed" = "$zl2NoServedPrev" ]; then
zl2Latency=0
else
zl2Latency=$(echo "$zl2Duration $zl2DurationPrev $zl2NoServed $zl2NoServedPrev" | awk '{ zl2Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl2Lat}' )
zl2Latency=$(echo "$zl2Duration $zl2DurationPrev $zl2NoServed $zl2NoServedPrev" | awk '{ zl2Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl2Lat}')
fi
if [ "$zl3NoServed" = "$zl3NoServedPrev" ];
then
if [ "$zl3NoServed" = "$zl3NoServedPrev" ]; then
zl3Latency=0
else
zl3Latency=$(echo "$zl3Duration $zl3DurationPrev $zl3NoServed $zl3NoServedPrev" | awk '{ zl3Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl3Lat}' )
zl3Latency=$(echo "$zl3Duration $zl3DurationPrev $zl3NoServed $zl3NoServedPrev" | awk '{ zl3Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl3Lat}')
fi
if [ "$zl4NoServed" = "$zl4NoServedPrev" ];
then
if [ "$zl4NoServed" = "$zl4NoServedPrev" ]; then
zl4Latency=0
else
zl4Latency=$(echo "$zl4Duration $zl4DurationPrev $zl4NoServed $zl4NoServedPrev" | awk '{ zl4Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl4Lat}' )
zl4Latency=$(echo "$zl4Duration $zl4DurationPrev $zl4NoServed $zl4NoServedPrev" | awk '{ zl4Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl4Lat}')
fi
if [ "$zl5NoServed" = "$zl5NoServedPrev" ];
then
if [ "$zl5NoServed" = "$zl5NoServedPrev" ]; then
zl5Latency=0
else
zl5Latency=$(echo "$zl5Duration $zl5DurationPrev $zl5NoServed $zl5NoServedPrev" | awk '{ zl5Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl5Lat}' )
zl5Latency=$(echo "$zl5Duration $zl5DurationPrev $zl5NoServed $zl5NoServedPrev" | awk '{ zl5Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl5Lat}')
fi
if [ "$zl6NoServed" = "$zl6NoServedPrev" ];
then
if [ "$zl6NoServed" = "$zl6NoServedPrev" ]; then
zl6Latency=0
else
zl6Latency=$(echo "$zl6Duration $zl6DurationPrev $zl6NoServed $zl6NoServedPrev" | awk '{ zl6Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl6Lat}' )
zl6Latency=$(echo "$zl6Duration $zl6DurationPrev $zl6NoServed $zl6NoServedPrev" | awk '{ zl6Lat = ($1 - $2) / ($3 - $4) / 1000000.0; print zl6Lat}')
fi
echo "total.value " $totalLatency

View File

@ -1,3 +1,12 @@
#!/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 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the response codes of tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title mod_tile HTTP response codes'
@ -49,13 +48,12 @@ if [ "$1" = "config" ]; then
exit 0
fi
data=$(wget -q http://localhost/mod_tile -O -)
data=`wget -q http://localhost/mod_tile -O -`
ok_resp=`expr match "$data" '.*NoResp200: \([0-9]*\)'`
nm_resp=`expr match "$data" '.*NoResp304: \([0-9]*\)'`
fnf_resp=`expr match "$data" '.*NoResp404: \([0-9]*\)'`
error_resp=`expr match "$data" '.*NoResp5XX: \([0-9]*\)'`
ok_resp=$(expr match "$data" '.*NoResp200: \([0-9]*\)')
nm_resp=$(expr match "$data" '.*NoResp304: \([0-9]*\)')
fnf_resp=$(expr match "$data" '.*NoResp404: \([0-9]*\)')
error_resp=$(expr match "$data" '.*NoResp5XX: \([0-9]*\)')
echo "response200.value " $ok_resp
echo "response304.value " $nm_resp

View File

@ -1,3 +1,12 @@
#!/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 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the response codes of tiles returned by mod_tile
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title mod_tile responses by zoom layer'
@ -56,43 +55,40 @@ if [ "$1" = "config" ]; then
exit 0
fi
data=$(wget -q http://localhost/mod_tile -O -)
data=`wget -q 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]*\)'`
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;
resp_19=0
fi
if [ -z "$resp_20" ]; then
resp_20=0;
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`
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)

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the rendering throughput of Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the rendering throughput of Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Renderd throughput'
@ -64,12 +63,12 @@ if [ "$1" = "config" ]; then
exit 0
fi
reqprocessed=`sed -e '/^ReqRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqprioprocessed=`sed -e '/^ReqPrioRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqpriolowprocessed=`sed -e '/^ReqLowRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
dirtprocessed=`sed -e '/^DirtyRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqbulkprocessed=`sed -e '/^ReqBulkRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
dropped=`sed -e '/^DropedRequest/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqprocessed=$(sed -e '/^ReqRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqprioprocessed=$(sed -e '/^ReqPrioRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqpriolowprocessed=$(sed -e '/^ReqLowRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
dirtprocessed=$(sed -e '/^DirtyRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqbulkprocessed=$(sed -e '/^ReqBulkRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
dropped=$(sed -e '/^DropedRequest/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
echo "req.value " $reqprocessed
echo "reqLow.value " $reqpriolowprocessed

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor queue length of tiles submited for rendering in renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor queue length of tiles submited for rendering in renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Renderd queue length'
@ -47,11 +46,11 @@ if [ "$1" = "config" ]; then
exit 0
fi
reqlength=`sed -e '/^ReqQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqpriolength=`sed -e '/^ReqPrioQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqpriolowlength=`sed -e '/^ReqLowQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqbulklength=`sed -e '/^ReqBulkQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
dirtlength=`sed -e '/^DirtQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqlength=$(sed -e '/^ReqQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqpriolength=$(sed -e '/^ReqPrioQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqpriolowlength=$(sed -e '/^ReqLowQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqbulklength=$(sed -e '/^ReqBulkQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
dirtlength=$(sed -e '/^DirtQueueLength/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
echo "reqPrio.value " $reqpriolength
echo "req.value " $reqlength

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor queue time spent rendering per queue by renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor queue time spent rendering per queue by renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Renderd time spent by queue'
@ -62,12 +61,11 @@ if [ "$1" = "config" ]; then
exit 0
fi
reqTime=`sed -e '/^TimeRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqprioTime=`sed -e '/^TimePrioRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqpriolowTime=`sed -e '/^TimeLowRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqbulkTime=`sed -e '/^TimeBulkRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
dirtyTime=`sed -e '/^TimeDirtyRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
reqTime=$(sed -e '/^TimeRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqprioTime=$(sed -e '/^TimePrioRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqpriolowTime=$(sed -e '/^TimeLowRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
reqbulkTime=$(sed -e '/^TimeBulkRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
dirtyTime=$(sed -e '/^TimeDirtyRendered/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
echo "req.value " $reqTime
echo "reqLow.value " $reqpriolowTime

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the rendering throughput of Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the rendering throughput of Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Renderd throughput by zoom'
@ -64,35 +63,34 @@ if [ "$1" = "config" ]; then
exit 0
fi
req0=`sed -e '/^ZoomRendered00/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req1=`sed -e '/^ZoomRendered01/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req2=`sed -e '/^ZoomRendered02/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req3=`sed -e '/^ZoomRendered03/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req4=`sed -e '/^ZoomRendered04/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req5=`sed -e '/^ZoomRendered05/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req6=`sed -e '/^ZoomRendered06/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req7=`sed -e '/^ZoomRendered07/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req8=`sed -e '/^ZoomRendered08/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req9=`sed -e '/^ZoomRendered09/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req10=`sed -e '/^ZoomRendered10/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req11=`sed -e '/^ZoomRendered11/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req12=`sed -e '/^ZoomRendered12/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req13=`sed -e '/^ZoomRendered13/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req14=`sed -e '/^ZoomRendered14/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req15=`sed -e '/^ZoomRendered15/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req16=`sed -e '/^ZoomRendered16/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req17=`sed -e '/^ZoomRendered17/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req18=`sed -e '/^ZoomRendered18/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req19=`sed -e '/^ZoomRendered19/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req20=`sed -e '/^ZoomRendered20/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req0=$(sed -e '/^ZoomRendered00/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req1=$(sed -e '/^ZoomRendered01/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req2=$(sed -e '/^ZoomRendered02/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req3=$(sed -e '/^ZoomRendered03/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req4=$(sed -e '/^ZoomRendered04/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req5=$(sed -e '/^ZoomRendered05/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req6=$(sed -e '/^ZoomRendered06/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req7=$(sed -e '/^ZoomRendered07/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req8=$(sed -e '/^ZoomRendered08/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req9=$(sed -e '/^ZoomRendered09/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req10=$(sed -e '/^ZoomRendered10/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req11=$(sed -e '/^ZoomRendered11/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req12=$(sed -e '/^ZoomRendered12/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req13=$(sed -e '/^ZoomRendered13/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req14=$(sed -e '/^ZoomRendered14/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req15=$(sed -e '/^ZoomRendered15/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req16=$(sed -e '/^ZoomRendered16/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req17=$(sed -e '/^ZoomRendered17/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req18=$(sed -e '/^ZoomRendered18/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req19=$(sed -e '/^ZoomRendered19/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req20=$(sed -e '/^ZoomRendered20/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
if [ -z req19 ]; then req19=0; fi
if [ -z req20 ]; then req20=0; fi
echo "z1.value " `expr $req0 + $req1 + + $req2 + $req3 + $req4 + $req5 + $req6 + $req7 + $req8`
echo "z2.value " `expr $req9 + $req10 + + $req11 + $req12`
echo "z3.value " `expr $req13 + $req14`
echo "z4.value " `expr $req15 + $req16`
echo "z5.value " `expr $req17 + $req18`
echo "z6.value " `expr $req19 + $req20`
echo "z1.value " $(expr $req0 + $req1 + + $req2 + $req3 + $req4 + $req5 + $req6 + $req7 + $req8)
echo "z2.value " $(expr $req9 + $req10 + + $req11 + $req12)
echo "z3.value " $(expr $req13 + $req14)
echo "z4.value " $(expr $req15 + $req16)
echo "z5.value " $(expr $req17 + $req18)
echo "z6.value " $(expr $req19 + $req20)

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the time spent rendering per zoom by Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the time spent rendering per zoom by Renderd
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Renderd time spent by zoom'
@ -67,39 +66,37 @@ if [ "$1" = "config" ]; then
echo 'zoomtime6.draw STACK'
echo 'zoomtime6.info Time for Metatiles for z19 - z20'
exit 0
fi
req0=`sed -e '/^TimeRenderedZoom00/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req1=`sed -e '/^TimeRenderedZoom01/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req2=`sed -e '/^TimeRenderedZoom02/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req3=`sed -e '/^TimeRenderedZoom03/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req4=`sed -e '/^TimeRenderedZoom04/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req5=`sed -e '/^TimeRenderedZoom05/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req6=`sed -e '/^TimeRenderedZoom06/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req7=`sed -e '/^TimeRenderedZoom07/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req8=`sed -e '/^TimeRenderedZoom08/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req9=`sed -e '/^TimeRenderedZoom09/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req10=`sed -e '/^TimeRenderedZoom10/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req11=`sed -e '/^TimeRenderedZoom11/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req12=`sed -e '/^TimeRenderedZoom12/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req13=`sed -e '/^TimeRenderedZoom13/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req14=`sed -e '/^TimeRenderedZoom14/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req15=`sed -e '/^TimeRenderedZoom15/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req16=`sed -e '/^TimeRenderedZoom16/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req17=`sed -e '/^TimeRenderedZoom17/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req18=`sed -e '/^TimeRenderedZoom18/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req19=`sed -e '/^TimeRenderedZoom19/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req20=`sed -e '/^TimeRenderedZoom20/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats`
req0=$(sed -e '/^TimeRenderedZoom00/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req1=$(sed -e '/^TimeRenderedZoom01/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req2=$(sed -e '/^TimeRenderedZoom02/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req3=$(sed -e '/^TimeRenderedZoom03/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req4=$(sed -e '/^TimeRenderedZoom04/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req5=$(sed -e '/^TimeRenderedZoom05/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req6=$(sed -e '/^TimeRenderedZoom06/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req7=$(sed -e '/^TimeRenderedZoom07/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req8=$(sed -e '/^TimeRenderedZoom08/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req9=$(sed -e '/^TimeRenderedZoom09/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req10=$(sed -e '/^TimeRenderedZoom10/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req11=$(sed -e '/^TimeRenderedZoom11/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req12=$(sed -e '/^TimeRenderedZoom12/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req13=$(sed -e '/^TimeRenderedZoom13/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req14=$(sed -e '/^TimeRenderedZoom14/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req15=$(sed -e '/^TimeRenderedZoom15/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req16=$(sed -e '/^TimeRenderedZoom16/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req17=$(sed -e '/^TimeRenderedZoom17/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req18=$(sed -e '/^TimeRenderedZoom18/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req19=$(sed -e '/^TimeRenderedZoom19/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
req20=$(sed -e '/^TimeRenderedZoom20/!d' -e 's/.*: //' -e q /run/renderd/renderd.stats)
if [ -z "$req19" ]; then req19=0; fi
if [ -z "$req20" ]; then req20=0; fi
echo "zoomtime1.value " `expr $req0 + $req1 + + $req2 + $req3 + $req4 + $req5 + $req6 + $req7 + $req8`
echo "zoomtime2.value " `expr $req9 + $req10 + + $req11 + $req12`
echo "zoomtime3.value " `expr $req13 + $req14`
echo "zoomtime4.value " `expr $req15 + $req16`
echo "zoomtime5.value " `expr $req17 + $req18`
echo "zoomtime6.value " `expr $req19 + $req20`
echo "zoomtime1.value " $(expr $req0 + $req1 + + $req2 + $req3 + $req4 + $req5 + $req6 + $req7 + $req8)
echo "zoomtime2.value " $(expr $req9 + $req10 + + $req11 + $req12)
echo "zoomtime3.value " $(expr $req13 + $req14)
echo "zoomtime4.value " $(expr $req15 + $req16)
echo "zoomtime5.value " $(expr $req17 + $req18)
echo "zoomtime6.value " $(expr $req19 + $req20)

View File

@ -1,3 +1,12 @@
#!/bin/sh
#
# Plugin to monitor the age of the imported data in the rendering db
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,16 +22,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
#
# Plugin to monitor the age of the imported data in the rendering db
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
if [ "$1" = "config" ]; then
echo 'graph_title Data import lag'
@ -35,9 +34,8 @@ if [ "$1" = "config" ]; then
exit 0
fi
tstamp=`sed -e '/^timestamp=/!d' -e 's/.*=//' -e 's/Z//' -e 's/T/Z/' -e 's/\\\\//' -e 's/\\\\//' -e q /home/osm/replicate/state.txt`
tstampsec=`date --date=$tstamp +%s`
nowsec=`date +%s`
tstamp=$(sed -e '/^timestamp=/!d' -e 's/.*=//' -e 's/Z//' -e 's/T/Z/' -e 's/\\\\//' -e 's/\\\\//' -e q /home/osm/replicate/state.txt)
tstampsec=$(date --date=$tstamp +%s)
nowsec=$(date +%s)
echo "age.value " `expr $nowsec - $tstampsec`
echo "age.value " $(expr $nowsec - $tstampsec)

View File

@ -1,3 +1,5 @@
#!/bin/sh
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,8 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
set -e
#*************************************************************************
@ -44,14 +44,12 @@ EXPIRY_MAXZOOM=18
#*************************************************************************
#*************************************************************************
m_info()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ $1" >> "$RUNLOG"
m_info() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ $1" >>"$RUNLOG"
}
m_error()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ [error] $1" >> "$RUNLOG"
m_error() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ [error] $1" >>"$RUNLOG"
m_info "resetting state"
/bin/cp $WORKOSM_DIR/last.state.txt $WORKOSM_DIR/state.txt || true
@ -62,15 +60,13 @@ m_error()
exit
}
m_ok()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ $1" >> "$RUNLOG"
m_ok() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ $1" >>"$RUNLOG"
}
getlock()
{
getlock() {
if [ -s $1 ]; then
if [ "$(ps -p `cat $1` | wc -l)" -gt 1 ]; then
if [ "$(ps -p $(cat $1) | wc -l)" -gt 1 ]; then
return 1 #false
fi
fi
@ -79,23 +75,21 @@ getlock()
return 0 #true
}
freelock()
{
freelock() {
rm "$1"
rm "$CHANGE_FILE"
}
if [ $# -eq 1 ] ; then
if [ $# -eq 1 ]; then
m_info "Initialising Osmosis replication system to $1"
mkdir $WORKOSM_DIR
$OSMOSIS_BIN --read-replication-interval-init workingDirectory=$WORKOSM_DIR 1>&2 2> "$OSMOSISLOG"
$OSMOSIS_BIN --read-replication-interval-init workingDirectory=$WORKOSM_DIR 1>&2 2>"$OSMOSISLOG"
wget "https://replicate-sequences.osm.mazdermind.de/?"$1"T00:00:00Z" -O $WORKOSM_DIR/state.txt
else
# make sure the lockfile is removed when we exit and then claim it
# make sure the lockfile is removed when we exit and then claim it
if ! getlock "$LOCK_FILE"; then
m_info "pid `cat $LOCK_FILE` still running"
m_info "pid $(cat $LOCK_FILE) still running"
exit 3
fi
@ -104,27 +98,27 @@ else
exit 2
fi
seq=`cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2`
seq=$(cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2)
m_ok "start import from seq-nr $seq, replag is `osmosis-db_replag -h`"
m_ok "start import from seq-nr $seq, replag is $(osmosis-db_replag -h)"
/bin/cp $WORKOSM_DIR/state.txt $WORKOSM_DIR/last.state.txt
m_ok "downloading diff"
if ! $OSMOSIS_BIN --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE 1>&2 2> "$OSMOSISLOG"; then
if ! $OSMOSIS_BIN --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE 1>&2 2>"$OSMOSISLOG"; then
m_error "Osmosis error"
fi
m_ok "importing diff"
EXPIRY_METAZOOM=`expr $EXPIRY_MAXZOOM - 3`
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_METAZOOM:$EXPIRY_METAZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
EXPIRY_METAZOOM=$(expr $EXPIRY_MAXZOOM - 3)
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_METAZOOM:$EXPIRY_METAZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2>"$PGSQLLOG"; then
m_error "osm2pgsql error"
fi
freelock "$LOCK_FILE"
m_ok "expiring tiles"
if ! render_expired --min-zoom=$EXPIRY_MINZOOM --max-zoom=$EXPIRY_MAXZOOM --touch-from=$EXPIRY_MINZOOM -s /run/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
if ! render_expired --min-zoom=$EXPIRY_MINZOOM --max-zoom=$EXPIRY_MAXZOOM --touch-from=$EXPIRY_MINZOOM -s /run/renderd.sock <"$EXPIRY_FILE.$$" 2>&1 | tail -8 >>"$EXPIRYLOG"; then
m_info "Expiry failed"
fi
@ -132,7 +126,4 @@ else
m_ok "Done with import"
fi

View File

@ -1,3 +1,5 @@
#!/bin/sh
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,8 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/sh
set -e
#------------------------------------------------------------------------------
@ -78,14 +78,12 @@ EXPIRY_MAXZOOM=20
#*************************************************************************
#*************************************************************************
m_info()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ $1" >> "$RUNLOG"
m_info() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ $1" >>"$RUNLOG"
}
m_error()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ [error] $1" >> "$RUNLOG"
m_error() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ [error] $1" >>"$RUNLOG"
m_info "resetting state"
/bin/cp $WORKOSM_DIR/last.state.txt $WORKOSM_DIR/state.txt || true
@ -96,15 +94,13 @@ m_error()
exit
}
m_ok()
{
echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ $1" >> "$RUNLOG"
m_ok() {
echo "[$(date +"%Y-%m-%d %H:%M:%S")] $$ $1" >>"$RUNLOG"
}
getlock()
{
getlock() {
if [ -s $1 ]; then
if [ "$(ps -p `cat $1` | wc -l)" -gt 1 ]; then
if [ "$(ps -p $(cat $1) | wc -l)" -gt 1 ]; then
return 1 #false
fi
fi
@ -113,25 +109,23 @@ getlock()
return 0 #true
}
freelock()
{
freelock() {
rm "$1"
rm "$CHANGE_FILE"
}
if [ $# -eq 1 ] ; then
if [ $# -eq 1 ]; then
m_info "Initialising Osmosis replication system to $1"
mkdir $WORKOSM_DIR
$OSMOSIS_BIN --read-replication-interval-init workingDirectory=$WORKOSM_DIR 1>&2 2> "$OSMOSISLOG"
$OSMOSIS_BIN --read-replication-interval-init workingDirectory=$WORKOSM_DIR 1>&2 2>"$OSMOSISLOG"
wget "http://replicate-sequences.osm.mazdermind.de/?"$1"T00:00:00Z" -O $WORKOSM_DIR/state.txt
mv $WORKOSM_DIR/configuration.txt $WORKOSM_DIR/configuration_orig.txt
sed "s!baseUrl=http://planet.openstreetmap.org/replication/minute!baseUrl=https://planet.openstreetmap.org/replication/minute!" $WORKOSM_DIR/configuration_orig.txt > $WORKOSM_DIR/configuration.txt
sed "s!baseUrl=http://planet.openstreetmap.org/replication/minute!baseUrl=https://planet.openstreetmap.org/replication/minute!" $WORKOSM_DIR/configuration_orig.txt >$WORKOSM_DIR/configuration.txt
else
# make sure the lockfile is removed when we exit and then claim it
# make sure the lockfile is removed when we exit and then claim it
if ! getlock "$LOCK_FILE"; then
m_info "pid `cat $LOCK_FILE` still running"
m_info "pid $(cat $LOCK_FILE) still running"
exit 3
fi
@ -140,79 +134,76 @@ else
exit 2
fi
# -----------------------------------------------------------------------------
# Add disk space check from https://github.com/zverik/regional
# -----------------------------------------------------------------------------
MIN_DISK_SPACE_MB=500
# -----------------------------------------------------------------------------
# Add disk space check from https://github.com/zverik/regional
# -----------------------------------------------------------------------------
MIN_DISK_SPACE_MB=500
if `python -c "import os, sys; st=os.statvfs('$BASE_DIR'); sys.exit(1 if st.f_bavail*st.f_frsize/1024/1024 > $MIN_DISK_SPACE_MB else 0)"`; then
if $(python -c "import os, sys; st=os.statvfs('$BASE_DIR'); sys.exit(1 if st.f_bavail*st.f_frsize/1024/1024 > $MIN_DISK_SPACE_MB else 0)"); then
m_info "there is less than $MIN_DISK_SPACE_MB MB left"
exit 4
fi
fi
seq=`cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2`
seq=$(cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2)
m_ok "start import from seq-nr $seq, replag is `osmosis-db_replag -h`"
m_ok "start import from seq-nr $seq, replag is $(osmosis-db_replag -h)"
/bin/cp $WORKOSM_DIR/state.txt $WORKOSM_DIR/last.state.txt
m_ok "downloading diff"
if ! $OSMOSIS_BIN --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE 1>&2 2> "$OSMOSISLOG"; then
if ! $OSMOSIS_BIN --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE 1>&2 2>"$OSMOSISLOG"; then
m_error "Osmosis error"
fi
m_ok "filtering diff"
if ! $TRIM_BIN $TRIM_OPTIONS $TRIM_REGION_OPTIONS -z $CHANGE_FILE $CHANGE_FILE 1>&2 2>> "$RUNLOG"; then
m_ok "filtering diff"
if ! $TRIM_BIN $TRIM_OPTIONS $TRIM_REGION_OPTIONS -z $CHANGE_FILE $CHANGE_FILE 1>&2 2>>"$RUNLOG"; then
m_error "Trim_osc error"
fi
fi
m_ok "importing diff"
#------------------------------------------------------------------------------
# Previously openstreetmap-tiles-update-expire tried to dirty layer
# "$EXPIRY_MAXZOOM - 3" (which was 15) only. Instead we write all expired
# tiles in range to the list (note the "-" rather than ":" in the "-e"
# parameter).
#------------------------------------------------------------------------------
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_MINZOOM-$EXPIRY_MAXZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
#------------------------------------------------------------------------------
# Previously openstreetmap-tiles-update-expire tried to dirty layer
# "$EXPIRY_MAXZOOM - 3" (which was 15) only. Instead we write all expired
# tiles in range to the list (note the "-" rather than ":" in the "-e"
# parameter).
#------------------------------------------------------------------------------
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_MINZOOM-$EXPIRY_MAXZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2>"$PGSQLLOG"; then
m_error "osm2pgsql error"
fi
#------------------------------------------------------------------------------
# The lockfile is normally removed before we expire tiles because that is
# something thatcan be done in parallel with further processing. In order to
# avoid rework, if actually rerendering is done rather than just deleting or
# dirtying, it makes sense to move it lower down.
#------------------------------------------------------------------------------
# m_ok "Import complete; removing lock file"
# freelock "$LOCK_FILE"
#------------------------------------------------------------------------------
# The lockfile is normally removed before we expire tiles because that is
# something thatcan be done in parallel with further processing. In order to
# avoid rework, if actually rerendering is done rather than just deleting or
# dirtying, it makes sense to move it lower down.
#------------------------------------------------------------------------------
# m_ok "Import complete; removing lock file"
# freelock "$LOCK_FILE"
m_ok "expiring tiles"
#------------------------------------------------------------------------------
# When expiring tiles we need to define the style sheet if it's not "default".
# In this case it's "ajt".
# Previously all tiles on the "dirty" list between $EXPIRY_MINZOOM and
# $EXPIRY_MAXZOOM were dirtied. We currently re-render
# tiles >= $EXPIRY_MINZOOM and < $EXPIRY_DELETEFROM, expiry from 14 and
# delete >= $EXPIRY_DELETEFROM and <= $EXPIRY_MAXZOOM.
# The default path to renderd.sock is fixed.
#
# Note no --touch-from=$EXPIRY_TOUCHFROM
#------------------------------------------------------------------------------
if ! render_expired --map=ajt --min-zoom=$EXPIRY_MINZOOM --delete-from=$EXPIRY_DELETEFROM --max-zoom=$EXPIRY_MAXZOOM -s /var/run/renderd/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
#------------------------------------------------------------------------------
# When expiring tiles we need to define the style sheet if it's not "default".
# In this case it's "ajt".
# Previously all tiles on the "dirty" list between $EXPIRY_MINZOOM and
# $EXPIRY_MAXZOOM were dirtied. We currently re-render
# tiles >= $EXPIRY_MINZOOM and < $EXPIRY_DELETEFROM, expiry from 14 and
# delete >= $EXPIRY_DELETEFROM and <= $EXPIRY_MAXZOOM.
# The default path to renderd.sock is fixed.
#
# Note no --touch-from=$EXPIRY_TOUCHFROM
#------------------------------------------------------------------------------
if ! render_expired --map=ajt --min-zoom=$EXPIRY_MINZOOM --delete-from=$EXPIRY_DELETEFROM --max-zoom=$EXPIRY_MAXZOOM -s /var/run/renderd/renderd.sock <"$EXPIRY_FILE.$$" 2>&1 | tail -8 >>"$EXPIRYLOG"; then
m_info "Expiry failed"
fi
rm "$EXPIRY_FILE.$$"
#------------------------------------------------------------------------------
# Only remove the lock file after expiry (if system is slow we want to delay
# the next import, not have multiple render_expired processes running)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Only remove the lock file after expiry (if system is slow we want to delay
# the next import, not have multiple render_expired processes running)
#------------------------------------------------------------------------------
freelock "$LOCK_FILE"
m_ok "Done with import"
fi

View File

@ -1,3 +1,5 @@
#!/bin/bash
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,28 +15,31 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/bash
STATE=/var/cache/renderd/tiles/.osmosis/state.txt
rep=`cat ${STATE} |\
grep 'timestamp' |\
awk '{split($0, a, "="); print a[2]}' |\
tr 'T' ' ' |\
xargs -I{} ${BINPATH}date --utc --date "{}" +%s`
is=`date --utc +%s`
rep=$(cat ${STATE} |
grep 'timestamp' |
awk '{split($0, a, "="); print a[2]}' |
tr 'T' ' ' |
xargs -I{} ${BINPATH}date --utc --date "{}" +%s)
is=$(date --utc +%s)
lag=$(($is - $rep))
if [ "$1" = "-h" ]; then
if [ $lag -gt 86400 ]; then echo $(($lag / 86400)) "day(s) and" $((($lag % 86400) / 3600)) "hour(s)";
elif [ $lag -gt 3600 ]; then echo $(($lag / 3600)) "hour(s)";
elif [ $lag -gt 60 ]; then echo $(($lag / 60)) "minute(s)";
else echo $lag "second(s)";
if [ $lag -gt 86400 ]; then
echo $(($lag / 86400)) "day(s) and" $((($lag % 86400) / 3600)) "hour(s)"
elif [ $lag -gt 3600 ]; then
echo $(($lag / 3600)) "hour(s)"
elif [ $lag -gt 60 ]; then
echo $(($lag / 60)) "minute(s)"
else
echo $lag "second(s)"
fi
else
echo $lag;
echo $lag
fi

View File

@ -1,3 +1,5 @@
#!/bin/bash
#
# Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
#
# This program is free software; you can redistribute it and/or
@ -13,9 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see http://www.gnu.org/licenses/.
#!/bin/bash
for z in `seq 0 18`
do
(cd $z; ../../render_old -z $z -Z $z &> render.txt) &
for z in $(seq 0 18); do
(
cd $z
../../render_old -z $z -Z $z &>render.txt
) &
done