]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/replication_delay
Add a bunch more cookbooks
[chef.git] / cookbooks / munin / files / default / plugins / replication_delay
diff --git a/cookbooks/munin/files/default/plugins/replication_delay b/cookbooks/munin/files/default/plugins/replication_delay
new file mode 100755 (executable)
index 0000000..e88ae97
--- /dev/null
@@ -0,0 +1,28 @@
+#!/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,/'
+        exit 0 
+fi 
+tstamp=`sed -e '/^timestamp=/!d' -e 's/.*=//' -e 's/Z//' -e 's/T/Z/' -e 's/\\\\//' -e 's/\\\\//' -e q /home/jburgess/replicate/state.txt` 
+tstampsec=`date --date=$tstamp +%s` 
+nowsec=`date +%s` 
+echo "age.value " `expr $nowsec - $tstampsec`
\ No newline at end of file