summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDjuri Baars <dsbaars@gmail.com>2015-06-23 19:49:12 +0200
committerDjuri Baars <dsbaars@gmail.com>2015-06-23 19:49:12 +0200
commit563e9114e1a6e0be97aee7e47a572606c136dae1 (patch)
tree3e324a4851821309bc610f617c3c91502ea5e2a8
parentb7970c391ced72ecb444616dfd16236b26198143 (diff)
downloadmunin-563e9114e1a6e0be97aee7e47a572606c136dae1.tar.gz
munin-563e9114e1a6e0be97aee7e47a572606c136dae1.tar.bz2
munin-563e9114e1a6e0be97aee7e47a572606c136dae1.tar.xz
munin-563e9114e1a6e0be97aee7e47a572606c136dae1.zip
Add SNMP and port configurability
-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