]> git.openstreetmap.org Git - nominatim.git/blob - munin/nominatim_importlag
README: tiny markdown syntax error
[nominatim.git] / munin / nominatim_importlag
1 #!/bin/sh
2 #
3 # Plugin to monitor the age of the imported data in the rendering db
4 #
5 # Can be configured through libpq environment variables, for example
6 # PGUSER, PGDATABASE, etc. See man page of psql for more information
7 #
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/
11 #
12 # [nominatim_*]
13 # user www-data
14 # env.PGUSER www-data
15 # env.PGPORT 5432
16 # env.PGDATABASE nominatim
17 # env.age_warning 21600
18 # env.age_critical 86400
19
20 # Parameters:
21 #
22 #       config   (required)
23 #       autoconf (optional - used by munin-config)
24 #
25
26 . $MUNIN_LIBDIR/plugins/plugin.sh
27
28 if [ "$1" = "config" ]; then
29
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'
35         echo 'age.type GAUGE'
36         echo 'age.cdef age,60,/'
37         print_warning age
38         print_critical age
39         exit 0
40 fi
41
42
43 delay=`psql -c "copy (select extract(epoch from timezone('utc', now())-lastimportdate)::int from import_status) to stdout"`
44
45
46 echo "age.value $delay"