From 7dd7d09cf5394729fb3859085cc5b6bb81283438 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 8 Feb 2013 16:44:34 +0100 Subject: [PATCH] Add Makefile rule to install munin plugin --- tools/checkfds.sh | 23 ++++++++++------------- tools/munin/Makefile | 17 +++++++++++++++++ tools/munin/windshaft_fds.conf.in | 5 +++++ 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 tools/munin/Makefile create mode 100644 tools/munin/windshaft_fds.conf.in diff --git a/tools/checkfds.sh b/tools/checkfds.sh index 81e3b88d..c43b0bb3 100755 --- a/tools/checkfds.sh +++ b/tools/checkfds.sh @@ -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 []" >&2 + echo " or: [TILER_ENVIRONMENT=] $0" >&2 + exit 1 fi http_port=$(echo "console.log(require('${TILER_ENVIRONMENT}').port)" | node) || exit 1 diff --git a/tools/munin/Makefile b/tools/munin/Makefile new file mode 100644 index 00000000..04257833 --- /dev/null +++ b/tools/munin/Makefile @@ -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 diff --git a/tools/munin/windshaft_fds.conf.in b/tools/munin/windshaft_fds.conf.in new file mode 100644 index 00000000..2579a221 --- /dev/null +++ b/tools/munin/windshaft_fds.conf.in @@ -0,0 +1,5 @@ +# Configuration file for munin plugin + +[windshaft_fds] +user root +env.TILER_ENVIRONMENT @PWD@/../../config/environments/production.js