From 11548575e4c0ff4cd5865c5d4f2622af3c97ff24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Wed, 18 Jan 2017 17:47:33 +0100
Subject: [PATCH] Moved Munin setup.

---
 1.Utilities/0_setup.py                        |  2 +-
 .../0_setup.sh                                |  0
 31.Install_munin/0_setup.sh                   | 40 -----------------
 {7.Nginx => 6.Nginx}/0_setup.py               |  0
 {7.Nginx => 6.Nginx}/crossdomain.xml          |  0
 .../vhost_mediaserver-msuser.conf             |  0
 {7.Nginx => 6.Nginx}/vhost_msmonitor.conf     |  0
 {7.Nginx => 6.Nginx}/vhost_skyreach.conf      |  0
 {7.Nginx => 6.Nginx}/vhost_streaming.conf     |  0
 {7.Nginx => 6.Nginx}/vhost_videos.conf        |  0
 7.Munin/0_setup.sh                            | 43 +++++++++++++++++++
 launcher.sh                                   | 10 ++---
 12 files changed, 49 insertions(+), 46 deletions(-)
 rename {32.Install_monitor => 31.Install_monitor}/0_setup.sh (100%)
 delete mode 100755 31.Install_munin/0_setup.sh
 rename {7.Nginx => 6.Nginx}/0_setup.py (100%)
 rename {7.Nginx => 6.Nginx}/crossdomain.xml (100%)
 rename {7.Nginx => 6.Nginx}/vhost_mediaserver-msuser.conf (100%)
 rename {7.Nginx => 6.Nginx}/vhost_msmonitor.conf (100%)
 rename {7.Nginx => 6.Nginx}/vhost_skyreach.conf (100%)
 rename {7.Nginx => 6.Nginx}/vhost_streaming.conf (100%)
 rename {7.Nginx => 6.Nginx}/vhost_videos.conf (100%)
 create mode 100755 7.Munin/0_setup.sh

diff --git a/1.Utilities/0_setup.py b/1.Utilities/0_setup.py
index 43356ff9..5ec72cc9 100644
--- a/1.Utilities/0_setup.py
+++ b/1.Utilities/0_setup.py
@@ -9,7 +9,7 @@ def setup(interactive=True):
     cmds = [
         'apt-get clean',
         'apt-get update',
-        'apt-get install --yes make ipython ipython3 vim netcat git htop iotop bmon host lm-sensors munin munin-node pciutils ntp nfs-client smartmontools pwgen ntpdate dialog',
+        'apt-get install --yes make ipython ipython3 vim netcat git htop iotop bmon host lm-sensors pciutils ntp nfs-client smartmontools pwgen ntpdate dialog',
         '[ -f ~/.vimrc ] || echo "color ron" > ~/.vimrc',
     ]
     utils.run_commands(cmds)
diff --git a/32.Install_monitor/0_setup.sh b/31.Install_monitor/0_setup.sh
similarity index 100%
rename from 32.Install_monitor/0_setup.sh
rename to 31.Install_monitor/0_setup.sh
diff --git a/31.Install_munin/0_setup.sh b/31.Install_munin/0_setup.sh
deleted file mode 100755
index a4ab0b08..00000000
--- a/31.Install_munin/0_setup.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-source /root/envsetup/conf.sh
-
-# This script should be run after Nginx and Wowza setup (if they should be installed)
-
-# munin
-DEBIAN_FRONTEND=noninteractive apt-get install -y ubicast-config
-
-# configure alerts
-# detect where to insert
-LIG=$(grep -n contact.nagios.command /etc/munin/munin.conf | awk -F ":" '{print$1}')
-LIG=$(( $LIG + 1 ))
-
-head -n ${LIG} /etc/munin/munin.conf > /etc/munin/munin.conf.tmp
-
-cat << EOF >> /etc/munin/munin.conf.tmp
-contacts alert
-contact.alert.command mail -a "From:sysadmin <sysadmin@ubicast.eu>" -s "[munin] Alert on ${var:host}" sysadmin@ubicast.eu
-contact.alert.always_send warning critical
-
-[${MS_SERVER_NAME}]
-    address 127.0.0.1
-    use_node_name yes
-    memory.free.warning 512000000:
-EOF
-
-mv /etc/munin/munin.conf.tmp /etc/munin/munin.conf
-# modify df function https://redmine.ubicast.net/issues/17912
-sed -i "s@-P -l @-P@" /usr/share/munin/plugins/df
-
-# new skin templates
-cd /etc/munin
-git clone https://git.ubicast.net/mediaserver/munin-monitoring-theme.git
-mv /etc/munin/static /etc/munin/static.orig
-mv /etc/munin/templates /etc/munin/templates.orig
-cp -pr munin-monitoring-theme/templates/munstrap/static /etc/munin/
-cp -pr munin-monitoring-theme/templates/munstrap/templates /etc/munin/
-# service restart
-service munin restart || true
-service munin-node restart
diff --git a/7.Nginx/0_setup.py b/6.Nginx/0_setup.py
similarity index 100%
rename from 7.Nginx/0_setup.py
rename to 6.Nginx/0_setup.py
diff --git a/7.Nginx/crossdomain.xml b/6.Nginx/crossdomain.xml
similarity index 100%
rename from 7.Nginx/crossdomain.xml
rename to 6.Nginx/crossdomain.xml
diff --git a/7.Nginx/vhost_mediaserver-msuser.conf b/6.Nginx/vhost_mediaserver-msuser.conf
similarity index 100%
rename from 7.Nginx/vhost_mediaserver-msuser.conf
rename to 6.Nginx/vhost_mediaserver-msuser.conf
diff --git a/7.Nginx/vhost_msmonitor.conf b/6.Nginx/vhost_msmonitor.conf
similarity index 100%
rename from 7.Nginx/vhost_msmonitor.conf
rename to 6.Nginx/vhost_msmonitor.conf
diff --git a/7.Nginx/vhost_skyreach.conf b/6.Nginx/vhost_skyreach.conf
similarity index 100%
rename from 7.Nginx/vhost_skyreach.conf
rename to 6.Nginx/vhost_skyreach.conf
diff --git a/7.Nginx/vhost_streaming.conf b/6.Nginx/vhost_streaming.conf
similarity index 100%
rename from 7.Nginx/vhost_streaming.conf
rename to 6.Nginx/vhost_streaming.conf
diff --git a/7.Nginx/vhost_videos.conf b/6.Nginx/vhost_videos.conf
similarity index 100%
rename from 7.Nginx/vhost_videos.conf
rename to 6.Nginx/vhost_videos.conf
diff --git a/7.Munin/0_setup.sh b/7.Munin/0_setup.sh
new file mode 100755
index 00000000..fd7e29b6
--- /dev/null
+++ b/7.Munin/0_setup.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+source /root/envsetup/conf.sh
+
+# This script should be run after Nginx and Wowza setup (if they should be installed)
+
+# munin
+DEBIAN_FRONTEND=noninteractive apt-get install -y ubicast-config
+
+# modify df function https://redmine.ubicast.net/issues/17912
+sed -i "s@-P -l @-P@" /usr/share/munin/plugins/df
+
+
+# configure alerts
+# detect where to insert
+#LIG=$(grep -n contact.nagios.command /etc/munin/munin.conf | awk -F ":" '{print$1}')
+#LIG=$(( $LIG + 1 ))
+#head -n ${LIG} /etc/munin/munin.conf > /etc/munin/munin.conf.tmp
+
+#cat << EOF >> /etc/munin/munin.conf.tmp
+#contacts alert
+#contact.alert.command mail -a "From:sysadmin <sysadmin@ubicast.eu>" -s "[munin] Alert on ${var:host}" sysadmin@ubicast.eu
+#contact.alert.always_send warning critical
+
+#[${MS_SERVER_NAME}]
+#    address 127.0.0.1
+#    use_node_name yes
+#    memory.free.warning 512000000:
+#EOF
+
+#mv /etc/munin/munin.conf.tmp /etc/munin/munin.conf
+
+
+# new skin templates
+#cd /etc/munin
+#git clone https://git.ubicast.net/mediaserver/munin-monitoring-theme.git
+#mv /etc/munin/static /etc/munin/static.orig
+#mv /etc/munin/templates /etc/munin/templates.orig
+#cp -pr munin-monitoring-theme/templates/munstrap/static /etc/munin/
+#cp -pr munin-monitoring-theme/templates/munstrap/templates /etc/munin/
+
+# service restart
+service munin restart || true
+service munin-node restart
diff --git a/launcher.sh b/launcher.sh
index ec28eb27..9aab84f5 100755
--- a/launcher.sh
+++ b/launcher.sh
@@ -28,9 +28,9 @@ init() {
 
 monitor() {
     python3 /root/envsetup/envsetup.py 3
+    python3 /root/envsetup/envsetup.py 6
     python3 /root/envsetup/envsetup.py 7
     python3 /root/envsetup/envsetup.py 31
-    python3 /root/envsetup/envsetup.py 32
 }
 
 mediaserver() {
@@ -38,10 +38,10 @@ mediaserver() {
     python3 /root/envsetup/envsetup.py 5
     python3 /root/envsetup/envsetup.py 8
     python3 /root/envsetup/envsetup.py 61
-    python3 /root/envsetup/envsetup.py 7
+    python3 /root/envsetup/envsetup.py 6
     python3 /root/envsetup/envsetup.py 41
     python3 /root/envsetup/envsetup.py 42
-    python3 /root/envsetup/envsetup.py 7
+    python3 /root/envsetup/envsetup.py 6
 }
 
 worker() {
@@ -50,9 +50,9 @@ worker() {
 
 campusmanager() {
     python3 /root/envsetup/envsetup.py 3
-    python3 /root/envsetup/envsetup.py 7
+    python3 /root/envsetup/envsetup.py 6
     python3 /root/envsetup/envsetup.py 51
-    python3 /root/envsetup/envsetup.py 7
+    python3 /root/envsetup/envsetup.py 6
 }
 
 cache() {
-- 
GitLab