diff options
author | B. van Berkum <dev@dotmpe.com> | 2017-10-08 00:23:52 +0200 |
---|---|---|
committer | B. van Berkum <dev@dotmpe.com> | 2017-10-08 00:23:54 +0200 |
commit | 1e3a1a5534d07710d7592d4655f8b241d0e31128 (patch) | |
tree | fe295ce191de044b5f82e1cfc316aa72158b8d4a /start-munin.sh | |
parent | b1761604d8ec6f4dff913f6e3dc2a6fea3dae7d0 (diff) | |
download | munin-1e3a1a5534d07710d7592d4655f8b241d0e31128.tar.gz munin-1e3a1a5534d07710d7592d4655f8b241d0e31128.tar.bz2 munin-1e3a1a5534d07710d7592d4655f8b241d0e31128.tar.xz munin-1e3a1a5534d07710d7592d4655f8b241d0e31128.zip |
Support for SSH_NODES, like NODES and SNMP_NODES
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 |