3 # Plugin to monitor the age of the imported data in the rendering db
 
   5 # Can be configured through libpq environment variables, for example
 
   6 # PGUSER, PGDATABASE, etc. See man page of psql for more information
 
   8 # To configure munin for a default installation, add these lines to
 
   9 # the file /etc/munin/plugin-conf.d/munin-node or in any file in the
 
  10 # directory /etc/munin/plugin-conf.d/
 
  16 # env.PGDATABASE nominatim
 
  17 # env.age_warning 21600
 
  18 # env.age_critical 86400
 
  23 #       autoconf (optional - used by munin-config)
 
  26 . $MUNIN_LIBDIR/plugins/plugin.sh
 
  28 if [ "$1" = "config" ]; then
 
  30         echo 'graph_title Data import lag'
 
  31         echo 'graph_args --base 1000 -l 0'
 
  32         echo 'graph_vlabel minutes'
 
  33         echo 'graph_category nominatim'
 
  34         echo 'age.label DB import age'
 
  36         echo 'age.cdef age,60,/'
 
  43 delay=`psql -c "copy (select extract(epoch from timezone('utc', now())-lastimportdate)::int from import_status) to stdout"`
 
  46 echo "age.value $delay"