diff options
Diffstat (limited to 'start-munin.sh')
-rwxr-xr-x | start-munin.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/start-munin.sh b/start-munin.sh index e531dfd..71b2359 100755 --- a/start-munin.sh +++ b/start-munin.sh @@ -1,6 +1,7 @@ #!/bin/bash NODES=${NODES:-} SNMP_NODES=${SNMP_NODES:-} +SSH_NODES=${SSH_NODES:-} MUNIN_USERS=${MUNIN_USERS:-${MUNIN_USER:-user}} MUNIN_PASSWORDS=${MUNIN_PASSWORDS:-${MUNIN_PASSWORD:-password}} MAIL_CONF_PATH='/var/lib/munin/.mailrc' @@ -100,6 +101,26 @@ EOF fi done +for SSH_NODE in $SSH_NODES +do + NAME=`echo $SSH_NODE | cut -d ":" -f1` + HOST=`echo $SSH_NODE | cut -d ":" -f2` + PORT=`echo $SSH_NODE | cut -d ":" -f3` + if [ ${#PORT} -eq 0 ]; then + PORT=4949 + fi + if ! grep -q "'^$HOST$'" /etc/munin/munin.conf ; then + cat << EOF >> /etc/munin/munin.conf +[$NAME] + address ssh://$HOST/usr/bin/nc localhost 4949 + use_node_name yes + port $PORT + +EOF + echo "Added SSH node '$NAME' '$HOST'" + fi +done + [ -d /var/cache/munin/www ] || mkdir /var/cache/munin/www # placeholder html to prevent permission error if [ ! -e /var/cache/munin/www/index.html ]; then @@ -128,6 +149,7 @@ touch /etc/crontab /etc/cron.d/* /usr/sbin/munin-node echo "Using the following munin nodes:" echo $NODES +echo "(ssh) $SSH_NODES" echo "(snmp) $SNMP_NODES" # start spawn-cgi to enable CGI interface with munin (dynamix graph generation) spawn-fcgi -s /var/run/munin/fcgi-graph.sock -U munin -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph |