Permalink
Browse files

Merge pull request #32 from osm-fr/pr-for-drolbr

Adding delay monitoring for munin
  • Loading branch information...
2 parents 73159b3 + d7be6fa commit 0305739a3850a303fc292c436704171ee82d3967 @drolbr committed Mar 20, 2013
Showing with 30 additions and 2 deletions.
  1. +2 −0 munin/README
  2. +26 −0 munin/osm_replication_lag-api
  3. +2 −2 src/bin/fetch_osc_and_apply.sh
View
@@ -0,0 +1,2 @@
+This script will read the database path from /etc/default/overpass and then
+compute the delay between the database timestamp and now.
@@ -0,0 +1,26 @@
+#!/bin/sh
+# -*- sh -*-
+
+. /etc/default/overpass
+
+
+# configuration section
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title OSM OverpassDB lag'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel minutes behind main database'
+ echo 'graph_scale no'
+ echo 'graph_category osm'
+
+ echo 'lag.label replication lag'
+ echo 'lag.draw LINE'
+ echo 'lag.cdef lag,60,/'
+ echo 'lag.critical 1000'
+
+ exit 0
+fi
+
+lag=$(($(date +%s)-$(date +%s --utc -d "$(cat $DB_DIR/osm_base_version_munin | cut -f2 -d\" | sed s/"\\\\"/""/g | sed s/[ZT]/" "/g)" )))
+echo "lag.value $lag"
+exit 0
@@ -92,8 +92,8 @@ fetch_and_apply_minute_diff()
sleep 1
} else
{
- grep timestamp $TMP_STATE | cut -f2 -d\= > $DB_DIR/tmp
- mv $DB_DIR/tmp $DB_DIR/osm_base_version
+ grep timestamp $TMP_STATE | cut -f2 -d\= > $DB_DIR/osm_base_version
+ cp $DB_DIR/osm_base_version $DB_DIR/osm_base_version_munin
rm $TMP_STATE
return $ret
}; fi

0 comments on commit 0305739

Please sign in to comment.