summaryrefslogtreecommitdiffstats
path: root/start-munin.sh
diff options
context:
space:
mode:
authorSoulou <leo@unbekandt.eu>2015-04-30 16:31:07 +0200
committerSoulou <leo@unbekandt.eu>2015-04-30 16:31:07 +0200
commite3504cee99dab2331df59f6463e5be5ac222dedd (patch)
tree65b6681743022105241cc423eb035f96f826edc0 /start-munin.sh
downloadmunin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.gz
munin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.bz2
munin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.xz
munin-e3504cee99dab2331df59f6463e5be5ac222dedd.zip
Initial version
Diffstat (limited to 'start-munin.sh')
-rw-r--r--start-munin.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/start-munin.sh b/start-munin.sh
new file mode 100644
index 0000000..b0fb3b0
--- /dev/null
+++ b/start-munin.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+NODES=${NODES:-}
+MUNIN_USER=${MUNIN_USER:-user}
+MUNIN_PASSWORD=${MUNIN_PASSWORD:-password}
+
+htpasswd -b -c /etc/munin/htpasswd.users "$MUNIN_USER" "$MUNIN_PASSWORD"
+
+# generate node list
+for NODE in $NODES
+do
+ NAME=`echo $NODE | cut -d ":" -f1`
+ HOST=`echo $NODE | cut -d ":" -f2`
+ cat << EOF >> /etc/munin/munin.conf
+[$NAME]
+ address $HOST
+ use_node_name yes
+
+EOF
+done
+
+# placeholder html to prevent permission error
+if [ ! -e /var/cache/munin/www/index.html ]; then
+cat << EOF > /var/cache/munin/www/index.html
+<html>
+<head>
+ <title>Munin</title>
+</head>
+<body>
+Munin has not run yet. Please try again in a few moments.
+</body>
+</html>
+EOF
+chown munin:munin /var/cache/munin/www/index.html
+chmod g+w /var/cache/munin/www/index.html
+fi
+
+# start rsyslogd
+/usr/sbin/rsyslogd
+# start cron
+/usr/sbin/cron
+# start local munin-node
+/usr/sbin/munin-node
+echo "Using the following munin nodes:"
+echo $NODES
+# start apache
+/usr/sbin/nginx
+# show logs
+echo "Tailing /var/log/syslog..."
+tail -F /var/log/syslog /var/log/munin/munin-update.log