From 92d0046adc548038200fa8ce6eede5f8b8e93f9f Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Sun, 18 Feb 2018 21:26:19 +0000
Subject: [PATCH] changed from apache to nginx for the streaming test as the
 metrics are better

---
 infra/streaming/rspec.yml                  | 22 ++++----
 test/services/apache/install.sh            |  2 +-
 test/services/nginx/install.sh             | 33 ++++++------
 test/services/nginx/telegraf_template.conf | 61 ++++++++++++++++++++++
 4 files changed, 88 insertions(+), 30 deletions(-)

diff --git a/infra/streaming/rspec.yml b/infra/streaming/rspec.yml
index 8cbcda9..fa428cc 100644
--- a/infra/streaming/rspec.yml
+++ b/infra/streaming/rspec.yml
@@ -11,11 +11,11 @@ hosts:
       - guest: 9092
         host: 9092
     ip_address: "192.168.50.10"
-  - name: apache1
-    cpus: 2
-    memory: 4096
+  - name: nginx1
+    cpus: 1
+    memory: 2048
     disk: "10GB"
-    service_name: "apache"
+    service_name: "nginx"
     forward_ports:
       - guest: 80
         host: 8081
@@ -25,14 +25,14 @@ hosts:
     sfc_id_instance: "MS_I1"
     sf_id: "adaptive_streaming"
     sf_id_instance: "adaptive_streaming_I1"
-    ipendpoint_id: "adaptive_streaming_I1_apache1"
+    ipendpoint_id: "adaptive_streaming_I1_nginx1"
     influxdb_url: "http://192.168.50.10:8086"
     database_name: "CLMCMetrics"
-  - name: apache2
-    cpus: 2
-    memory: 4096
+  - name: nginx2
+    cpus: 1
+    memory: 2048
     disk: "10GB"
-    service_name: "apache"
+    service_name: "nginx"
     forward_ports:
       - guest: 80
         host: 8082
@@ -42,9 +42,9 @@ hosts:
     sfc_id_instance: "MS_I1"
     sf_id: "adaptive_streaming"
     sf_id_instance: "adaptive_streaming_I1"
-    ipendpoint_id: "adaptive_streaming_I1_apache2"
+    ipendpoint_id: "adaptive_streaming_I1_nginx2"
     influxdb_url: "http://192.168.50.10:8086"
-    database_name: "CLMCMetrics"
+    database_name: "CLMCMetrics"  
   - name: loadtest-streaming
     cpus: 2
     memory: 4096
diff --git a/test/services/apache/install.sh b/test/services/apache/install.sh
index 8ae0181..8b57de8 100755
--- a/test/services/apache/install.sh
+++ b/test/services/apache/install.sh
@@ -35,7 +35,7 @@ DEST_FILE=$DEST_DIR"/"$TEST_VIDEO_ARCHIVE
 
 # Copy files for MPEG-DASH testing
 curl "ftp://ftp.it-innovation.soton.ac.uk/testdata/video/"$TEST_VIDEO_ARCHIVE --user flame-rw:DR8ngj3ogSjd8gl -o $DEST_FILE
-tar -xvf $DEST_FILE -C /var/www/html/
+tar -xvf $DEST_FILE -C $DEST_DIR
 
 rm -rf $DEST_FILE
 mv $DEST_DIR"/"$TEST_VIDEO $DEST_DIR"/"test_video
diff --git a/test/services/nginx/install.sh b/test/services/nginx/install.sh
index 318996f..bdc349a 100755
--- a/test/services/nginx/install.sh
+++ b/test/services/nginx/install.sh
@@ -25,28 +25,25 @@
 #/////////////////////////////////////////////////////////////////////////
 
 # Install nginx
-sudo apt-get update
-yes Y | sudo apt-get install nginx 
+apt-get update
+yes Y | apt-get install nginx 
 
 # Need to set up basic stats as this not configured by default
 # http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
-echo "Coping new config file into nginx"
-cd /vagrant
-sudo rm ../etc/nginx/nginx.conf
-sudo cp test/services/nginx/nginx.conf ../etc/nginx/nginx.conf
-#cat test/services/nginx/nginx.conf > ../etc/nginx/nginx.conf
+cp -rf $REPO_ROOT/test/services/nginx/nginx.conf /etc/nginx/nginx.conf
+nginx -s reload
+systemctl start nginx
 
+# Copy in the test video, this needs to be part of a test set up and not here.
 
-sudo nginx -s reload
+TEST_VIDEO="20180212104221flame-project-full.mp4"
+TEST_VIDEO_ARCHIVE=$TEST_VIDEO".gz"
+DEST_DIR="/usr/share/nginx/html" 
+DEST_FILE=$DEST_DIR"/"$TEST_VIDEO_ARCHIVE
 
-# start NGINX
-sudo systemctl start nginx
-# --with-http_stub_status_module
-#nginx -V 2>&1 | grep -o with-http_stub_status_module
-#/vagrant/../etc/nginx/nginx.config
+# Copy files for MPEG-DASH testing
+curl "ftp://ftp.it-innovation.soton.ac.uk/testdata/video/"$TEST_VIDEO_ARCHIVE --user flame-rw:DR8ngj3ogSjd8gl -o $DEST_FILE
+tar -xvf $DEST_FILE -C $DEST_DIR
 
-# systemctl status telegraf -l
-
-
-
-# dpkg -l | grep -c nginx 
\ No newline at end of file
+rm -rf $DEST_FILE
+mv $DEST_DIR"/"$TEST_VIDEO $DEST_DIR"/"test_video
\ No newline at end of file
diff --git a/test/services/nginx/telegraf_template.conf b/test/services/nginx/telegraf_template.conf
index afd2531..8c059c3 100644
--- a/test/services/nginx/telegraf_template.conf
+++ b/test/services/nginx/telegraf_template.conf
@@ -94,6 +94,67 @@
 ###############################################################################
 #                                  INPUTS                                     #
 ###############################################################################
+# # Read metrics about network interface usage
+ [[inputs.net]]
+#   ## By default, telegraf gathers stats from any up interface (excluding loopback)
+#   ## Setting interfaces will tell it to gather these explicit interfaces,
+#   ## regardless of status.
+#   ##
+#   # interfaces = ["eth0"]
+
+# Read metrics about cpu usage
+[[inputs.cpu]]
+  ## Whether to report per-cpu stats or not
+  percpu = true
+  ## Whether to report total system cpu stats or not
+  totalcpu = true
+  ## If true, collect raw CPU time metrics.
+  collect_cpu_time = false
+  ## If true, compute and report the sum of all non-idle CPU states.
+ #report_active = false
+
+
+# Read metrics about disk usage by mount point
+[[inputs.disk]]
+  ## By default, telegraf gather stats for all mountpoints.
+  ## Setting mountpoints will restrict the stats to the specified mountpoints.
+  # mount_points = ["/"]
+
+  ## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
+  ## present on /run, /var/run, /dev/shm or /dev).
+  ignore_fs = ["tmpfs", "devtmpfs", "devfs"]
+
+
+# Read metrics about disk IO by device
+[[inputs.diskio]]
+  ## By default, telegraf will gather stats for all devices including
+  ## disk partitions.
+  ## Setting devices will restrict the stats to the specified devices.
+  # devices = ["sda", "sdb"]
+  ## Uncomment the following line if you need disk serial numbers.
+  # skip_serial_number = false
+  #
+  ## On systems which support it, device metadata can be added in the form of
+  ## tags.
+  ## Currently only Linux is supported via udev properties. You can view
+  ## available properties for a device by running:
+  ## 'udevadm info -q property -n /dev/sda'
+  # device_tags = ["ID_FS_TYPE", "ID_FS_USAGE"]
+  #
+  ## Using the same metadata source as device_tags, you can also customize the
+  ## name of the device via templates.
+  ## The 'name_templates' parameter is a list of templates to try and apply to
+  ## the device. The template may contain variables in the form of '$PROPERTY' or
+  ## '${PROPERTY}'. The first template which does not contain any variables not
+  ## present for the device is used as the device name tag.
+  ## The typical use case is for LVM volumes, to get the VG/LV name instead of
+  ## the near-meaningless DM-0 name.
+  # name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"]
+
+# Read metrics about memory usage
+[[inputs.mem]]
+  # no configuration
+
 # # Influx HTTP write listener
 [[inputs.http_listener]]
   ## Address and port to host HTTP listener on
-- 
GitLab