From 563e9114e1a6e0be97aee7e47a572606c136dae1 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Tue, 23 Jun 2015 19:49:12 +0200 Subject: Add SNMP and port configurability --- start-munin.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/start-munin.sh b/start-munin.sh index 66a2d4b..b2a6d78 100644 --- a/start-munin.sh +++ b/start-munin.sh @@ -1,5 +1,6 @@ #!/bin/bash NODES=${NODES:-} +SNMP_NODES=${SNMP_NODES:-} MUNIN_USER=${MUNIN_USER:-user} MUNIN_PASSWORD=${MUNIN_PASSWORD:-password} @@ -27,11 +28,36 @@ for NODE in $NODES do NAME=`echo $NODE | cut -d ":" -f1` HOST=`echo $NODE | cut -d ":" -f2` + PORT=`echo $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 $HOST use_node_name yes + port $PORT + +EOF + fi +done + +# generate node list +for NODE in $SNMP_NODES +do + NAME=`echo $NODE | cut -d ":" -f1` + HOST=`echo $NODE | cut -d ":" -f2` + PORT=`echo $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 $HOST + use_node_name no + port $PORT EOF fi -- cgit v1.2.3