2012-02-02 01:13:05 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Plugin to monitor the age of the imported data in the rendering db
|
|
|
|
#
|
2013-07-07 18:36:01 +04:00
|
|
|
# Can be configured through libpq environment variables, for example
|
|
|
|
# PGUSER, PGDATABASE, etc. See man page of psql for more information
|
|
|
|
#
|
2014-01-15 02:50:22 +04:00
|
|
|
# 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:
|
2012-02-02 01:13:05 +04:00
|
|
|
#
|
|
|
|
# config (required)
|
|
|
|
# autoconf (optional - used by munin-config)
|
|
|
|
#
|
2014-01-15 02:50:22 +04:00
|
|
|
|
|
|
|
. $MUNIN_LIBDIR/plugins/plugin.sh
|
|
|
|
|
2012-02-02 01:13:05 +04:00
|
|
|
if [ "$1" = "config" ]; then
|
2014-01-15 02:50:22 +04:00
|
|
|
|
|
|
|
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'
|
2012-02-02 01:13:05 +04:00
|
|
|
echo 'age.cdef age,60,/'
|
2014-01-15 02:50:22 +04:00
|
|
|
print_warning age
|
|
|
|
print_critical age
|
2012-02-02 01:13:05 +04:00
|
|
|
exit 0
|
|
|
|
fi
|
2014-01-15 02:50:22 +04:00
|
|
|
|
2012-02-02 01:13:05 +04:00
|
|
|
|
2013-07-07 18:36:01 +04:00
|
|
|
delay=`psql -c "copy (select extract(epoch from timezone('utc', now())-lastimportdate)::int from import_status) to stdout"`
|
2014-01-15 02:50:22 +04:00
|
|
|
|
|
|
|
|
2012-02-02 01:13:05 +04:00
|
|
|
echo "age.value $delay"
|