-#!/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
+#!/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)