]> git.openstreetmap.org Git - chef.git/blob - cookbooks/overpass/templates/default/munin_db_lag.erb
donate: redirect to support.osm.org
[chef.git] / cookbooks / overpass / templates / default / munin_db_lag.erb
1 #!/usr/bin/env bash
2
3 # DO NOT EDIT - This file is being maintained by Chef
4 #
5 # Based on: https://github.com/drolbr/Overpass-API/blob/way_based_areas/munin/osm_replication_lag-api
6
7 if [ "$1" = "config" ]; then
8
9         echo 'graph_title DB Lag'
10         echo 'graph_args --base 1000'
11         echo 'graph_vlabel minutes behind main database'
12         echo 'graph_category overpass'
13
14         echo 'lag.label replication lag'
15         echo 'lag.draw LINE'
16         echo 'lag.cdef lag,60,/'
17         echo 'lag.critical 1000'
18
19         exit 0
20 fi
21
22 lag=$(($(date +%s)-$(date +%s --utc -d "$(cat <%= @basedir %>/db/osm_base_version | cut -f2 -d\" | sed s/"\\\\"/""/g | sed s/[ZT]/" "/g)" )))
23 echo "lag.value $lag"