mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-12-22 13:52:13 +01:00
Accepted patch from Jozsef Marton. Plugins might now be added
dynamicly using the plugindir_ git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@24 35caa317-6b62-4e8a-81c0-b04f0c356266
This commit is contained in:
parent
f397470d73
commit
42963323c4
1 changed files with 19 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
# For latest version, see http://muninlite.sf.net/
|
# For latest version, see http://muninlite.sf.net/
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Rune Nordbøe Skillingstad <rune@skillingstad.no>
|
# Copyright (c) 2007-2011 Rune Nordbøe Skillingstad <rune@skillingstad.no>
|
||||||
#
|
#
|
||||||
# Licensed under GPLv2 (see LICENSE file for full License)
|
# Licensed under GPLv2 (see LICENSE file for full License)
|
||||||
#
|
#
|
||||||
|
@ -16,6 +16,10 @@ VERSION="@@VERSION@@"
|
||||||
|
|
||||||
@@CONF@@
|
@@CONF@@
|
||||||
|
|
||||||
|
# if plugindir_ is present in $PLUGINS,
|
||||||
|
# iexecutables (scripts, binaries) matching the following pattern will be scanned and operated as plugins
|
||||||
|
PLUGINPATTERN=$(dirname $0)"/munin-node-plugin.d/*"
|
||||||
|
|
||||||
# Remove unwanted plugins from this list
|
# Remove unwanted plugins from this list
|
||||||
PLUGINS="@@PLUGINS@@"
|
PLUGINS="@@PLUGINS@@"
|
||||||
# ===== LIB FUNCTIONS =====
|
# ===== LIB FUNCTIONS =====
|
||||||
|
@ -85,6 +89,20 @@ do
|
||||||
if netstat -s >/dev/null 2>&1; then
|
if netstat -s >/dev/null 2>&1; then
|
||||||
RES="$RES netstat"
|
RES="$RES netstat"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$PLUG" = "plugindir_" ]; then
|
||||||
|
for MYPLUGIN in $(ls -1 $PLUGINPATTERN 2>/dev/null );
|
||||||
|
do
|
||||||
|
if [ -f $MYPLUGIN -a -x $MYPLUGIN ]; then
|
||||||
|
MYPLUGINNAME=$(basename $MYPLUGIN)
|
||||||
|
#ensure we don't have name collision
|
||||||
|
if echo "$RES" | grep "\b$MYPLUGINNAME\b" >/dev/null 2>&1 ; then
|
||||||
|
MYPLUGINNAME="plugindir_$MYPLUGINNAME"
|
||||||
|
fi
|
||||||
|
RES="$RES $MYPLUGINNAME"
|
||||||
|
eval "fetch_${MYPLUGINNAME}() { $MYPLUGIN ; };"
|
||||||
|
eval "config_${MYPLUGINNAME}() { $MYPLUGIN config ; };"
|
||||||
|
fi
|
||||||
|
done
|
||||||
else
|
else
|
||||||
RES="$RES $PLUG";
|
RES="$RES $PLUG";
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue