]> jfr.im git - munin-plugins.git/commitdiff
support for a 2nd unbound plugin main
authorJohn Runyon <redacted>
Mon, 26 Feb 2024 11:41:38 +0000 (04:41 -0700)
committerJohn Runyon <redacted>
Mon, 26 Feb 2024 11:41:38 +0000 (04:41 -0700)
unbound_munin_

index 7aa2857db43de71b49a2b0307e5cae49e5b27bbc..44cf0766539356dd753647a1bd30e2f83056de51 100755 (executable)
@@ -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"