--- /dev/null
+#!/bin/bash
+
+LASTDBUPDATE=`cat /var/www/lastdbupdate.txt`
+
+TS2=`date '+%s' "--date=$LASTDBUPDATE"`
+TS1=`date '+%s'`
+
+if [ "$1" = "autoconf" ]; then
+ echo yes
+ exit 0
+fi
+
+if [ "$1" = "config" ]; then
+ echo 'graph_title databaselag'
+ echo 'graph_args --lower-limit 0 '
+ echo 'graph_vlabel Seconds our DB copy is lagging behind the official DB'
+ echo 'graph_category postgresql'
+fi
+
+echo 'dblag.label databaselag'
+echo 'dblag.type GAUGE'
+let "DELAY=TS1-TS2"
+echo "dblag.value $DELAY"
+