#!/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 - 2023 by mod_tile contributors (see AUTHORS file) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; If not, see http://www.gnu.org/licenses/. 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 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) echo "age.value " $(expr $nowsec - $tstampsec)