Add Makefile rule to install munin plugin

This commit is contained in:
Sandro Santilli 2013-02-08 16:44:34 +01:00
parent c314640c3b
commit 7dd7d09cf5
3 changed files with 32 additions and 13 deletions

View File

@ -1,15 +1,5 @@
#!/bin/sh
me=$0
if test -h "$me"; then
me=`readlink $me`
fi
ENV_DIR=$(cd `dirname "$me"`/../config/environments || exit 1; pwd)
if test -z "$TILER_ENVIRONMENT"; then
TILER_ENVIRONMENT=${ENV_DIR}/development.js
fi
if test "$1" = "config"; then
cat <<'EOM'
graph_title Tiler fd usage
@ -21,9 +11,16 @@ http.label Incoming http requests (max)
nfd.label Number of open file descriptors (max)
EOM
exit 0
elif test x"$1" != "x"; then
# override env file
TILER_ENVIRONMENT="${ENV_DIR}/${1}.js"
fi
if test x"$1" != x; then
TILER_ENVIRONMENT=$(cd $(dirname $0); pwd)/../config/environments/${1}.js
fi
if test -z "$TILER_ENVIRONMENT"; then
echo "Usage: $0 [<environment>]" >&2
echo " or: [TILER_ENVIRONMENT=<environment>] $0" >&2
exit 1
fi
http_port=$(echo "console.log(require('${TILER_ENVIRONMENT}').port)" | node) || exit 1

17
tools/munin/Makefile Normal file
View File

@ -0,0 +1,17 @@
MUNIN_PLUGINS_DIR=/etc/munin/plugins
MUNIN_PLUGINS_CONFIG_DIR=/etc/munin/plugin-conf.d
PWD=$(shell pwd)
all: windshaft_fds.conf
windshaft_fds.conf: windshaft_fds.conf.in
sed 's#@PWD@#$(PWD)#' < $< > $@
install-munin-plugin: windshaft_fds.conf
install -m 644 windshaft_fds.conf $(MUNIN_PLUGINS_CONFIG_DIR)/windshaft_fds.conf
install -m 755 ../checkfds.sh $(MUNIN_PLUGINS_DIR)/windshaft_fds
install: install-munin-plugin
clean:
rm -f windshaft_fds.conf

View File

@ -0,0 +1,5 @@
# Configuration file for munin plugin
[windshaft_fds]
user root
env.TILER_ENVIRONMENT @PWD@/../../config/environments/production.js