Initial commit.
This commit is contained in:
7
script/munin/README
Normal file
7
script/munin/README
Normal file
@@ -0,0 +1,7 @@
|
||||
to activate the munin plugins
|
||||
- copy "osm_replication_lag" to "/usr/share/munin/plugins"
|
||||
- make "/usr/share/munin/plugins/osm_replication_lag" executable
|
||||
- symlink "/usr/share/munin/plugins/osm_replication_lag" to "/etc/munin/plugins"
|
||||
- copy "osm_replication.conf" to "/etc/munin/plugin-conf.d"
|
||||
- edit "/etc/munin/plugin-conf.d/osm_replication.conf" and set the workingDirectory
|
||||
- restart the munin-node
|
15
script/munin/osm_replication.conf
Normal file
15
script/munin/osm_replication.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[osm*]
|
||||
|
||||
# the osmosis invocation may take some time
|
||||
timeout 60
|
||||
|
||||
# the system user that has access to the working directory, if it'S different
|
||||
# from "munin"
|
||||
#user osm
|
||||
|
||||
# path to the osmosis binary. if not set, osmosis is assumed to be in $PATH
|
||||
#env.osmosis /opt/osmosis/bin/osmosis
|
||||
|
||||
# working directory of the osmosis replication.
|
||||
# this must be set to make the munin plugin work
|
||||
#env.workingDirectory /path/to/state.txt
|
35
script/munin/osm_replication_lag
Executable file
35
script/munin/osm_replication_lag
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# -*- sh -*-
|
||||
|
||||
# load the munin plugin helper
|
||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
||||
|
||||
# if no workingDirectory has been configures
|
||||
if [ ! $workingDirectory ]; then
|
||||
# exit with an error
|
||||
echo "no workingDirectory configured" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# path to osmosis binary
|
||||
[ $osmosis ] || osmosis="osmosis"
|
||||
|
||||
# configuration section
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title OSM PostGIS Database Replag'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel seconds behind main database'
|
||||
echo 'graph_category osm'
|
||||
|
||||
echo 'lag.label replication lag'
|
||||
echo 'lag.draw LINE'
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# invoke osmosis to calculate the replication lag
|
||||
lag=$($osmosis --read-replication-lag workingDirectory="$workingDirectory" 2>/dev/null)
|
||||
echo "lag.value $lag"
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user