Skip to content
Snippets Groups Projects
Commit 62e13da0 authored by Simon Crowle's avatar Simon Crowle
Browse files

Provides automated provisioning of a dashboard and Kapacitor demonstrator

See ./test/streaming/manual.md for more information
parent e2594f51
No related branches found
No related tags found
No related merge requests found
...@@ -88,6 +88,7 @@ Vagrant.configure("2") do |config| ...@@ -88,6 +88,7 @@ Vagrant.configure("2") do |config|
case instance_name case instance_name
when 'clmc-service' when 'clmc-service'
instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["install_script"]}" instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["install_script"]}"
instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["config_script"]}"
instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["start_script"]}" instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["start_script"]}"
else else
# specific service install # specific service install
......
...@@ -12,6 +12,7 @@ hosts: ...@@ -12,6 +12,7 @@ hosts:
host: 9092 host: 9092
ip_address: "192.168.50.10" ip_address: "192.168.50.10"
install_script: "install-clmc-service.sh" install_script: "install-clmc-service.sh"
config_script: "config-clmc-service.sh"
start_script: "start-clmc-service.sh" start_script: "start-clmc-service.sh"
- name: apache1 - name: apache1
cpus: 1 cpus: 1
......
#!/bin/bash
#/////////////////////////////////////////////////////////////////////////
#//
#// (c) University of Southampton IT Innovation Centre, 2018
#//
#// Copyright in this software belongs to University of Southampton
#// IT Innovation Centre of Gamma House, Enterprise Road,
#// Chilworth Science Park, Southampton, SO16 7NS, UK.
#//
#// This software may not be used, sold, licensed, transferred, copied
#// or reproduced in whole or in part in any manner or form or in or
#// on any media by any person other than in accordance with the terms
#// of the Licence Agreement supplied with the software, or otherwise
#// without the prior written consent of the copyright owners.
#//
#// This software is distributed WITHOUT ANY WARRANTY, without even the
#// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#// PURPOSE, except where stated in the Licence Agreement supplied with
#// the software.
#//
#// Created By : Simon Crowle
#// Created Date : 14/02/2018
#// Created for Project : FLAME
#//
#/////////////////////////////////////////////////////////////////////////
# Get standard Kapacitor configuration file
wget -O /tmp/kapacitor.conf https://raw.githubusercontent.com/influxdata/kapacitor/master/etc/kapacitor/kapacitor.conf
# Rewrite slack config to point the CLMC channel
sed -i '345s/.*/ enabled = true/' /tmp/kapacitor.conf
sed -i '350s/.*/ url = "https:\/\/hooks.slack.com\/services\/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"/' /tmp/kapacitor.conf
sed -i '352s/.*/ channel = "#clmc"/' /tmp/kapacitor.conf
# Copy Kapacitor config to default location
sudo cp /tmp/kapacitor.conf /etc/kapacitor/
{"id":1,"cells":[{"i":"657dc6a9-1359-4f28-87c1-8174cab033e2","x":4,"y":2,"w":4,"h":3,"name":"Apache Endpoint 2 Request rate \u0026 Response time","queries":[{"query":"SELECT mean(\"ReqPerSec\") AS \"mean_ReqPerSec\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache2' GROUP BY time(10s)","label":"apache.ReqPerSec","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"ReqPerSec","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache2"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}},{"query":"SELECT mean(\"response_time\") AS \"mean_response_time\" FROM \"CLMCMetrics\".\"autogen\".\"net_response\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache2' GROUP BY time(10s)","label":"net_response.response_time","queryConfig":{"database":"CLMCMetrics","measurement":"net_response","retentionPolicy":"autogen","fields":[{"field":"response_time","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache2"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}}],"type":"line","links":{"self":"/chronograf/v1/dashboards/5/cells/657dc6a9-1359-4f28-87c1-8174cab033e2"}},{"i":"998dac9c-fdfb-43cb-905c-650082acf0fe","x":0,"y":2,"w":4,"h":3,"name":"Apache Endpoint 1 Request rate \u0026 Response time","queries":[{"query":"SELECT mean(\"ReqPerSec\") AS \"mean_ReqPerSec\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache1' GROUP BY time(10s)","label":"apache.ReqPerSec","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"ReqPerSec","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache1"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}},{"query":"SELECT mean(\"response_time\") AS \"mean_response_time\" FROM \"CLMCMetrics\".\"autogen\".\"net_response\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache1' GROUP BY time(10s)","label":"net_response.response_time","queryConfig":{"database":"CLMCMetrics","measurement":"net_response","retentionPolicy":"autogen","fields":[{"field":"response_time","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache1"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}}],"type":"line","links":{"self":"/chronograf/v1/dashboards/5/cells/998dac9c-fdfb-43cb-905c-650082acf0fe"}},{"i":"31c0e989-99a8-4340-bbd9-6e5a83826324","x":4,"y":5,"w":4,"h":4,"name":"Apache Endpoint 2 CPU Load \u0026 connection count","queries":[{"query":"SELECT mean(\"CPULoad\") AS \"mean_CPULoad\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache2' GROUP BY time(10s)","label":"apache.CPULoad","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"CPULoad","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache2"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}},{"query":"SELECT mean(\"ConnsTotal\") AS \"mean_ConnsTotal\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"host\"='apache2' GROUP BY time(10s)","label":"apache.ConnsTotal","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"ConnsTotal","funcs":["mean"]}],"tags":{"host":["apache2"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}}],"type":"line","links":{"self":"/chronograf/v1/dashboards/5/cells/31c0e989-99a8-4340-bbd9-6e5a83826324"}},{"i":"5836bf44-5af2-4dcd-8882-a4b658c58c9e","x":0,"y":5,"w":4,"h":4,"name":"Apache Endpoint 1 CPU Load \u0026 connection count","queries":[{"query":"SELECT mean(\"CPULoad\") AS \"mean_CPULoad\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache1' GROUP BY time(10s)","label":"apache.CPULoad","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"CPULoad","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache1"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}},{"query":"SELECT mean(\"ConnsTotal\") AS \"mean_ConnsTotal\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h AND \"ipendpoint\"='adaptive_streaming_I1_apache1' GROUP BY time(10s)","label":"apache.ConnsTotal","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"ConnsTotal","funcs":["mean"]}],"tags":{"ipendpoint":["adaptive_streaming_I1_apache1"]},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":true,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}}],"type":"line","links":{"self":"/chronograf/v1/dashboards/5/cells/5836bf44-5af2-4dcd-8882-a4b658c58c9e"}},{"i":"d3730e16-9c22-43d8-9f37-a98f76b04133","x":0,"y":0,"w":8,"h":2,"name":"Total Apache connections","queries":[{"query":"SELECT mean(\"ConnsTotal\") AS \"mean_ConnsTotal\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE time \u003e now() - 1h GROUP BY time(10s)","label":"apache.ConnsTotal","queryConfig":{"database":"CLMCMetrics","measurement":"apache","retentionPolicy":"autogen","fields":[{"field":"ConnsTotal","funcs":["mean"]}],"tags":{},"groupBy":{"time":"10s","tags":[]},"areTagsAccepted":false,"rawText":null,"range":{"upper":"","lower":"now() - 1h"}}}],"type":"line","links":{"self":"/chronograf/v1/dashboards/5/cells/d3730e16-9c22-43d8-9f37-a98f76b04133"}}],"templates":[],"name":"CLMC demo dashboard","links":{"self":"/chronograf/v1/dashboards/5","cells":"/chronograf/v1/dashboards/5/cells","templates":"/chronograf/v1/dashboards/5/templates"}}
\ No newline at end of file
{
"id" : "Request_Rate_Alert",
"type" : "batch",
"dbrps" : [{"db": "CLMCMetrics", "rp" : "autogen"}],
"script" : "var data = batch\r\n |query(''' SELECT mean(\"ReqPerSec\") AS \"mean_RPS\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE \"ipendpoint\"='adaptive_streaming_I1_apache1' ''')\r\n .period(5s)\r\n .every(5s)\r\n\r\nvar alert = data\r\n |alert()\r\n .id('{{ .Name }}\/adaptive_streaming_I1_apache1')\r\n .message('{{ .ID }} is {{ .Level }} Mean Requests Per Second: {{ index .Fields \"mean_RPS\" }}')\r\n .warn(lambda: \"mean_RPS\" > 0.2)\r\n .crit(lambda: \"mean_RPS\" > 0.5)\r\n .slack()\r\n .log( '\/tmp\/RPSLoad.log' )",
"status" : "enabled"
}
\ No newline at end of file
{
"id": "1",
"name": "CLMCKapacitor",
"url": "http://localhost:9092",
"active": false
}
\ No newline at end of file
{
"id": "1",
"name": "Influx 1",
"url": "http://localhost:8086",
"default": true,
"telegraf": "CLMCMetrics"
}
\ No newline at end of file
#!/bin/bash
#/////////////////////////////////////////////////////////////////////////
#//
#// (c) University of Southampton IT Innovation Centre, 2018
#//
#// Copyright in this software belongs to University of Southampton
#// IT Innovation Centre of Gamma House, Enterprise Road,
#// Chilworth Science Park, Southampton, SO16 7NS, UK.
#//
#// This software may not be used, sold, licensed, transferred, copied
#// or reproduced in whole or in part in any manner or form or in or
#// on any media by any person other than in accordance with the terms
#// of the Licence Agreement supplied with the software, or otherwise
#// without the prior written consent of the copyright owners.
#//
#// This software is distributed WITHOUT ANY WARRANTY, without even the
#// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#// PURPOSE, except where stated in the Licence Agreement supplied with
#// the software.
#//
#// Created By : Simon Crowle
#// Created Date : 14/02/2018
#// Created for Project : FLAME
#//
#/////////////////////////////////////////////////////////////////////////
# Set up CLMC data source
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/sources -d @./clmcSource.json
# Set up CLMC Kapacitor
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/sources/1/kapacitors -d @./clmcKapacitor.json
# Set up CLMC demo rule
curl -i -X POST -H "Content-Type: application/json" http://localhost:9092/kapacitor/v1/tasks -d @./clmcDemoRule.json
# Set up CLMC Dashboard
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/dashboards -d @./clmcDashboard.json
\ No newline at end of file
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
// the software. // the software.
// //
// Created By : Michael Boniface // Created By : Michael Boniface
// Updated By : Simon Crowle
// Created Date : 18-12-2017 // Created Date : 18-12-2017
// Update Date : 14-02-2018
// Created for Project : FLAME // Created for Project : FLAME
--> -->
...@@ -30,7 +32,28 @@ The following command brings up the services ...@@ -30,7 +32,28 @@ The following command brings up the services
`vagrant --infra=streaming up` `vagrant --infra=streaming up`
* clmc-service: configured with influx, kapacitor, chornograf * clmc-service: configured with influx, kapacitor, chornograf
* apache1@DC1, apache2@DC2: configured with apache and a test video located at http://192.168.50.11:80/test_video/stream.mpd on the internal vbox network adn at http://localhost:8890/test-video/stream.mpd if accessing from the host machine * apache1@DC1, apache2@DC2: configured with apache and a test video located at http://192.168.50.11:80/test_video/stream.mpd on the internal vbox network and at http://localhost:8081/test_video/stream.mpd if accessing from the host machine
## Automatic set-up of the CLMC dashboard demonstrator
To automatically set up a demonstrator CLMC dashboard and Kapacitor, run the following:
```
cd ./test/streaming/
./config-dashboard.sh
```
And then point your browser to:
`http://localhost:8888`
## Manual set-up of Chronograf's CLMC data source
If you __do not__ want to run the automatic set-up, basic entry to the Chronograf dashboard is as follows:
1. Point your browser to: [http://localhost:8888](http://localhost:8888)
2. Enter your connection string: `http://localhost:8086`
3. Enter the Name: `Influx 1`
4. Enter the Telegraf database: `CLMCMetrics`
## Manual test on Windows ## Manual test on Windows
...@@ -51,29 +74,43 @@ The video should play. ...@@ -51,29 +74,43 @@ The video should play.
### Query the data ### Query the data
Open Chronograph by entering the following URL into a browser on the host http://localhost:8888 Open Chronograph by entering the following URL into a browser on the host http://localhost:8888. Your CLMC data source, Kapacitor and demonstration dashboard should be ready for you to explore.
Connect with Press the Data Explorer in the menu and select the apache measurement and create a query such as
* Connection String: http://localhost:8086 `SELECT mean("BytesPerSec") AS "mean_BytesPerSec" FROM "CLMCMetrics"."autogen"."apache" WHERE time > now() - 5m GROUP BY time(10s)`
* Name: Influx 1
* Telegraf database: CLMCMetrics
Press the Data Explorer in the menu ## KPI triggers
Select the apache measurement and create a query such as In this demonstrator an example KPI rule has been set up in Kapacitor which fires when the average requests per second on the Apache 1 server goes above certain thresholds ( a 'warning' at 0.2 requests/second and a 'critical' message at 0.5 requests/second ). The TICKscript specification for this rule is as follows:
`SELECT mean("BytesPerSec") AS "mean_BytesPerSec" FROM "CLMCMetrics"."autogen"."apache" WHERE time > now() - 5m GROUP BY time(10s)` ```
dbrp "CLMCMetrics"."autogen"
var data = batch
|query(''' SELECT mean("ReqPerSec") AS "mean_RPS" FROM "CLMCMetrics"."autogen"."apache" WHERE "ipendpoint"='adaptive_streaming_I1_apache1' ''')
.period(5s)
.every(5s)
var alert = data
|alert()
.id('{{ .Name }}/adaptive_streaming_I1_apache1')
.message('{{ .ID }} is {{ .Level }} Mean Requests Per Second: {{ index .Fields "mean_RPS" }}')
.warn(lambda: "mean_RPS" > 0.2)
.crit(lambda: "mean_RPS" > 0.5)
.slack()
.log( '/tmp/RPSLoad.log' )
```
## Set a KPI trigger Alerts are sent both an internal logging within the CLMC service file system and also to a FLAME demo Slack service:
Press Alerting in the menu https://flamedemo-itinnov.slack.com
Connect to Kapacitor on http://locahost:9092 Alerts can be found under the '#clmc' channel.
Create a rule CLMCMetrics.apache.cpu_load > 0.02 ### Kapacitor rules in Chronograf's GUI
There's all sorts of notification possibilities Additional rules can be added to this demonstrator either via the Chronograf GUI (see [here](https://docs.influxdata.com/chronograf/v1.4/introduction/getting-started/#4-connect-chronograf-to-kapacitor) for more information) or by using the Kapacitor HTTP API and TICKscript (for an introduction, [look here](https://docs.influxdata.com/kapacitor/v1.4/tick/)).
## Automatic test using JMeter and VLC command line ## Automatic test using JMeter and VLC command line
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment