osm_replication_lag-api 625 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. # -*- sh -*-
  3. . /etc/default/overpass
  4. # configuration section
  5. if [ "$1" = "config" ]; then
  6. echo 'graph_title OSM OverpassDB lag'
  7. echo 'graph_args --base 1000'
  8. echo 'graph_vlabel minutes behind main database'
  9. echo 'graph_scale no'
  10. echo 'graph_category osm'
  11. echo 'lag.label replication lag'
  12. echo 'lag.draw LINE'
  13. echo 'lag.cdef lag,60,/'
  14. echo 'lag.critical 1000'
  15. exit 0
  16. fi
  17. lag=$(($(date +%s)-$(date +%s --utc -d "$(cat $DB_DIR/osm_base_version_munin | cut -f2 -d\" | sed s/"\\\\"/""/g | sed s/[ZT]/" "/g)" )))
  18. echo "lag.value $lag"
  19. exit 0