Hallöchen,
Ich wollte gerade für 3 Munin Nodes einen SSH Tunnel aufsetzen.
Hier findet man sogar ein passendes Script dazu:
MuninSSHTunneling - Munin - Trac
Hier mal der Code:
Das Problem ist beim Ausführen:
Zeile237 und 238:
Zeile 255+256, ist dann das Ende der Datei.
Wo liegt der Fehler?
Ich wollte gerade für 3 Munin Nodes einen SSH Tunnel aufsetzen.
Hier findet man sogar ein passendes Script dazu:
MuninSSHTunneling - Munin - Trac
Hier mal der Code:
Code:
'check')
# Start or restart ssh tunnel to munin clients in a DMZ
# File with the munin configuration
MUNINCONF=/etc/opt/munin/munin.conf
# IP-Address for localhost (local tunnel endpoint)
IP=127.0.0.1
# tempoary list
MUNINLIST=/tmp/munin.list
cat $MUNINCONF | grep -v "#" | grep "address $IP" --before-context=1 --after-context=1 > $MUNINLIST
# set an 'end of file' marker
echo "--" >> $MUNINLIST
COUNTER=0
cat $MUNINLIST | while read line ; do
if [ "$line" != "--" ] ; then
if [ "$COUNTER" = "0" ] ; then
CLIENTNAME=`echo $line | tr -d '[] '
fi
if [ "`echo $line | grep port`" ] ; then
PORT=`echo $line | awk '{ print $2 }'`
fi
#echo "looking for $CLIENTNAME : $PORT"
COUNTER=`echo "$COUNTER + 1" | bc`
else
echo "done with this triple, check for tunnel $CLIENTNAME port $PORT"
if [ "`ps -eaf | grep ssh | grep nNgf | grep $PORT | grep -v grep`" ] ; then
echo "tunnel to $CLIENTNAME port $PORT is up"
else
echo "SSH tunnel ${CLIENTNAME} NOT alive ... Restarting ..."
/usr/bin/ssh -nNgf -L $PORT:localhost:4949 root@$CLIENTNAME
logger -p daemon.notice "SSH tunnel ${CLIENTNAME} NOT alive ... Restarting ...
"
sleep 1
fi
COUNTER=0
echo
fi
done
;;
Das Problem ist beim Ausführen:
Code:
/etc/init.d/munin-node check
/etc/init.d/munin-node: line 238: unexpected EOF while looking for matching ``'
/etc/init.d/munin-node: line 256: syntax error: unexpected end of file
Zeile237 und 238:
Code:
echo "done with this triple, check for tunnel $CLIENTNAME port $PORT"
if [ "`ps -eaf | grep ssh | grep nNgf | grep $PORT | grep -v grep`" ] ; then
Zeile 255+256, ist dann das Ende der Datei.
Wo liegt der Fehler?