X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d2080b805cf3f4af751ad228a4d4eb31c6982d50..27968a88f8d7fcc542cee54ebc9d66093564fda4:/cookbooks/munin/files/default/plugins/replication_delay?ds=sidebyside diff --git a/cookbooks/munin/files/default/plugins/replication_delay b/cookbooks/munin/files/default/plugins/replication_delay index 2a787d1b9..27dd10809 100755 --- a/cookbooks/munin/files/default/plugins/replication_delay +++ b/cookbooks/munin/files/default/plugins/replication_delay @@ -1,29 +1,29 @@ -#!/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' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel minutes' - echo 'graph_category renderd' - echo 'age.label DB import age' - echo 'age.type GAUGE' - echo 'age.cdef age,60,/' - exit 0 -fi +#!/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' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel minutes' + echo 'graph_category renderd' + echo 'age.label DB import age' + echo 'age.type GAUGE' + echo 'age.cdef age,60,/' + echo 'age.warning :600' + echo 'age.critical :3600' + exit 0 +fi + +tstamp=$(osmium fileinfo --extended --get=data.timestamp.last /var/lib/replicate/changes-latest.osc.gz) +tstampsec=$(date --date=${tstamp} +%s) +nowsec=$(date +%s) -state=${state:-/home/jburgess/replicate/state.txt} -tstamp=`sed -e '/^timestamp=/!d' -e 's/.*=//' -e 's/Z//' -e 's/T/Z/' -e 's/\\\\//' -e 's/\\\\//' -e q ${state}` -tstampsec=`date --date=$tstamp +%s` -nowsec=`date +%s` - - echo "age.value " `expr $nowsec - $tstampsec`