X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/5c43821ebe5de5892dcc4aa482d02c72e86bf637..c41f2fed2133668dc3179813261d39d3ff69cbdd:/munin/nominatim_importlag diff --git a/munin/nominatim_importlag b/munin/nominatim_importlag index 8d69f3ce..0960ff5a 100755 --- a/munin/nominatim_importlag +++ b/munin/nominatim_importlag @@ -2,26 +2,45 @@ # # Plugin to monitor the age of the imported data in the rendering db # -# Parameters: +# Can be configured through libpq environment variables, for example +# PGUSER, PGDATABASE, etc. See man page of psql for more information +# +# To configure munin for a default installation, add these lines to +# the file /etc/munin/plugin-conf.d/munin-node or in any file in the +# directory /etc/munin/plugin-conf.d/ +# +# [nominatim_*] +# user www-data +# env.PGUSER www-data +# env.PGPORT 5432 +# env.PGDATABASE nominatim +# env.age_warning 21600 +# env.age_critical 86400 + +# Parameters: # # config (required) # autoconf (optional - used by munin-config) # - + +. $MUNIN_LIBDIR/plugins/plugin.sh + if [ "$1" = "config" ]; then - - echo 'graph_title Data import lag' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel minutes' - echo 'graph_category nominatim' - echo 'age.label DB import age' - echo 'age.type GAUGE' + + echo 'graph_title Data import lag' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel minutes' + echo 'graph_category nominatim' + echo 'age.label DB import age' + echo 'age.type GAUGE' echo 'age.cdef age,60,/' + print_warning age + print_critical age exit 0 fi - -delay=`psql -d nominatim -c 'copy (select extract(epoch from now()-lastimportdate)::int from import_status) to stdout'` - - + +delay=`psql -c "copy (select extract(epoch from timezone('utc', now())-lastimportdate)::int from import_status) to stdout"` + + echo "age.value $delay"