From: John Runyon Date: Mon, 26 Feb 2024 11:41:38 +0000 (-0700) Subject: support for a 2nd unbound plugin X-Git-Url: https://jfr.im/git/munin-plugins.git/commitdiff_plain/1f4eda3c63a6678e7f71cc24a6c564f83c936ae5 support for a 2nd unbound plugin --- diff --git a/unbound_munin_ b/unbound_munin_ index 7aa2857..44cf076 100755 --- a/unbound_munin_ +++ b/unbound_munin_ @@ -94,8 +94,9 @@ BSD =cut -state="${MUNIN_PLUGSTATE}/unbound.state" -seentags="${MUNIN_PLUGSTATE}/unbound-seentags.state" +my_state_name=`echo $0 | sed -e 's/^.*unbound\(2\?\)_munin_.*$/unbound\1/'` +state="${MUNIN_PLUGSTATE}/$my_state_name.state" +seentags="${MUNIN_PLUGSTATE}/$my_state_name-seentags.state" warn=${spoof_warn:-1000} crit=${spoof_crit:-100000} lock=$state.lock @@ -171,7 +172,7 @@ get_state ( ) { fi ssh -o ControlPath=/tmp/unbound-ssh.$$.sock -M -o ExitOnForwardFailure=yes -p 2222 -fnN -L /tmp/unbound-control.$$.sock:/tmp/unbound-control.sock root@$router >/dev/null # open an SSH tunnel - unbound-control -c /etc/unbound/unbound-control.conf -s /tmp/unbound-control.$$.sock stats > $state # run unbound-control over the SSH tunnel socket + unbound-control -c /etc/unbound/unbound-control.conf -s /tmp/unbound-control.$$.sock stats >$state # run unbound-control over the SSH tunnel socket if test $? -ne 0; then echo "error retrieving data from unbound server" rm -f $lock @@ -211,7 +212,7 @@ if test "$1" = "suggest" ; then fi # determine my type, by name -id=`echo $0 | sed -e 's/^.*unbound_munin_//'` +id=`echo $0 | sed -e 's/^.*unbound2\?_munin_//'` if test "$id"x = ""x; then # some default to keep people sane. id="hits"