summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rwxr-xr-xstart-munin.sh22
2 files changed, 23 insertions, 0 deletions
diff --git a/README.md b/README.md
index d32553d..cc39d1b 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ The port is always optional, default is 4949
* `NODES` format: `name1:ip1[:port1] name2:ip2[:port2] …`
* `SNMP_NODES` format: `name1:ip1[:port1]` …
+* `SSH_NODES` format: `name1:ip1[:port1]` …
## Port
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