Skip to content

Commit

Permalink
Allow overriding Munin script URLs with an environment variable (#420)
Browse files Browse the repository at this point in the history
* Also allow overriding `RENDERD_STATS` (defaults to `/run/renderd/renderd.stats`)
* Also allow overriding `REPLICATION_STATE` (defaults to `/home/osm/replicate/state.txt`)
  • Loading branch information
hummeltech authored Jun 26, 2024
1 parent 344215a commit 3612c5f
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 63 deletions.
2 changes: 1 addition & 1 deletion utils/munin/mod_tile_fresh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if [ "$1" = "config" ]; then
exit 0
fi

data=$(wget -q http://localhost/mod_tile -O -)
data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)

fresh=$(expr match "$data" '.*NoFreshCache: \([0-9]*\)')
freshRender=$(expr match "$data" '.*NoFreshRender: \([0-9]*\)')
Expand Down
2 changes: 1 addition & 1 deletion utils/munin/mod_tile_latency
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fi

#MUNIN_STATEFILE=latency.state

data=$(wget -q http://localhost/mod_tile -O -)
data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)

totalDuration=$(expr match "$data" '.*DurationTileBufferReads: \([0-9]*\)')
noTotal=$(expr match "$data" '.*NoTileBufferReads: \([0-9]*\)')
Expand Down
2 changes: 1 addition & 1 deletion utils/munin/mod_tile_response
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if [ "$1" = "config" ]; then
exit 0
fi

data=$(wget -q http://localhost/mod_tile -O -)
data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)

ok_resp=$(expr match "$data" '.*NoResp200: \([0-9]*\)')
nm_resp=$(expr match "$data" '.*NoResp304: \([0-9]*\)')
Expand Down
2 changes: 1 addition & 1 deletion utils/munin/mod_tile_zoom
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if [ "$1" = "config" ]; then
exit 0
fi

data=$(wget -q http://localhost/mod_tile -O -)
data=$(wget -q ${MOD_TILE_URL:-http://localhost/mod_tile} -O -)

resp_0=$(expr match "$data" '.*NoRespZoom00: \([0-9]*\)')
resp_1=$(expr match "$data" '.*NoRespZoom01: \([0-9]*\)')
Expand Down
12 changes: 6 additions & 6 deletions utils/munin/renderd_processed
Original file line number Diff line number Diff line change
Expand Up @@ -63,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 ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqprioprocessed=$(sed -e '/^ReqPrioRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqpriolowprocessed=$(sed -e '/^ReqLowRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
dirtprocessed=$(sed -e '/^DirtyRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqbulkprocessed=$(sed -e '/^ReqBulkRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
dropped=$(sed -e '/^DropedRequest/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})

echo "req.value " $reqprocessed
echo "reqLow.value " $reqpriolowprocessed
Expand Down
10 changes: 5 additions & 5 deletions utils/munin/renderd_queue
Original file line number Diff line number Diff line change
Expand Up @@ -46,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 ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqpriolength=$(sed -e '/^ReqPrioQueueLength/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqpriolowlength=$(sed -e '/^ReqLowQueueLength/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqbulklength=$(sed -e '/^ReqBulkQueueLength/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
dirtlength=$(sed -e '/^DirtQueueLength/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})

echo "reqPrio.value " $reqpriolength
echo "req.value " $reqlength
Expand Down
10 changes: 5 additions & 5 deletions utils/munin/renderd_queue_time
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +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 ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqprioTime=$(sed -e '/^TimePrioRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqpriolowTime=$(sed -e '/^TimeLowRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
reqbulkTime=$(sed -e '/^TimeBulkRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
dirtyTime=$(sed -e '/^TimeDirtyRendered/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})

echo "req.value " $reqTime
echo "reqLow.value " $reqpriolowTime
Expand Down
42 changes: 21 additions & 21 deletions utils/munin/renderd_zoom
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ 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 ${RENDERD_STATS:-/run/renderd/renderd.stats})
req1=$(sed -e '/^ZoomRendered01/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req2=$(sed -e '/^ZoomRendered02/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req3=$(sed -e '/^ZoomRendered03/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req4=$(sed -e '/^ZoomRendered04/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req5=$(sed -e '/^ZoomRendered05/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req6=$(sed -e '/^ZoomRendered06/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req7=$(sed -e '/^ZoomRendered07/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req8=$(sed -e '/^ZoomRendered08/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req9=$(sed -e '/^ZoomRendered09/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req10=$(sed -e '/^ZoomRendered10/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req11=$(sed -e '/^ZoomRendered11/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req12=$(sed -e '/^ZoomRendered12/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req13=$(sed -e '/^ZoomRendered13/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req14=$(sed -e '/^ZoomRendered14/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req15=$(sed -e '/^ZoomRendered15/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req16=$(sed -e '/^ZoomRendered16/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req17=$(sed -e '/^ZoomRendered17/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req18=$(sed -e '/^ZoomRendered18/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req19=$(sed -e '/^ZoomRendered19/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req20=$(sed -e '/^ZoomRendered20/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})

if [ -z req19 ]; then req19=0; fi
if [ -z req20 ]; then req20=0; fi
Expand Down
42 changes: 21 additions & 21 deletions utils/munin/renderd_zoom_time
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,27 @@ if [ "$1" = "config" ]; then
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 ${RENDERD_STATS:-/run/renderd/renderd.stats})
req1=$(sed -e '/^TimeRenderedZoom01/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req2=$(sed -e '/^TimeRenderedZoom02/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req3=$(sed -e '/^TimeRenderedZoom03/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req4=$(sed -e '/^TimeRenderedZoom04/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req5=$(sed -e '/^TimeRenderedZoom05/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req6=$(sed -e '/^TimeRenderedZoom06/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req7=$(sed -e '/^TimeRenderedZoom07/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req8=$(sed -e '/^TimeRenderedZoom08/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req9=$(sed -e '/^TimeRenderedZoom09/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req10=$(sed -e '/^TimeRenderedZoom10/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req11=$(sed -e '/^TimeRenderedZoom11/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req12=$(sed -e '/^TimeRenderedZoom12/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req13=$(sed -e '/^TimeRenderedZoom13/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req14=$(sed -e '/^TimeRenderedZoom14/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req15=$(sed -e '/^TimeRenderedZoom15/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req16=$(sed -e '/^TimeRenderedZoom16/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req17=$(sed -e '/^TimeRenderedZoom17/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req18=$(sed -e '/^TimeRenderedZoom18/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req19=$(sed -e '/^TimeRenderedZoom19/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})
req20=$(sed -e '/^TimeRenderedZoom20/!d' -e 's/.*: //' -e q ${RENDERD_STATS:-/run/renderd/renderd.stats})

if [ -z "$req19" ]; then req19=0; fi
if [ -z "$req20" ]; then req20=0; fi
Expand Down
2 changes: 1 addition & 1 deletion utils/munin/replication_delay
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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)
tstamp=$(sed -e '/^timestamp=/!d' -e 's/.*=//' -e 's/Z//' -e 's/T/Z/' -e 's/\\\\//' -e 's/\\\\//' -e q ${REPLICATION_STATE:-/home/osm/replicate/state.txt})
tstampsec=$(date --date=$tstamp +%s)
nowsec=$(date +%s)

Expand Down

0 comments on commit 3612c5f

Please sign in to comment.