summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoulou <leo.unbek@gmail.com>2015-12-13 15:04:23 -0800
committerSoulou <leo.unbek@gmail.com>2015-12-13 15:04:23 -0800
commit05c06af8b04a2fad87b93c007a5a42ec4ededc37 (patch)
tree3e324a4851821309bc610f617c3c91502ea5e2a8
parentb7970c391ced72ecb444616dfd16236b26198143 (diff)
parent563e9114e1a6e0be97aee7e47a572606c136dae1 (diff)
downloadmunin-05c06af8b04a2fad87b93c007a5a42ec4ededc37.tar.gz
munin-05c06af8b04a2fad87b93c007a5a42ec4ededc37.tar.bz2
munin-05c06af8b04a2fad87b93c007a5a42ec4ededc37.tar.xz
munin-05c06af8b04a2fad87b93c007a5a42ec4ededc37.zip
Merge pull request #1 from dsbaars/configurable-port
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