summaryrefslogtreecommitdiffstats
path: root/start-munin.sh
diff options
context:
space:
mode:
Diffstat (limited to 'start-munin.sh')
-rw-r--r--start-munin.sh26
1 files changed, 26 insertions, 0 deletions
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