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

Merge branch 'dashboardDemo' into 'integration'

Dashboard demo

See merge request FLAME/flame-clmc!13
parents aad0b77f 00b9cf49
No related branches found
No related tags found
No related merge requests found
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
{"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": "1",
"name": "Influx 1",
"url": "http://localhost:8086",
"default": true,
"telegraf": "CLMCMetrics"
}
\ No newline at end of file
This diff is collapsed.
{
"id": "1",
"name": "CLMCKapacitor",
"url": "http://localhost:9092",
"active": false
}
\ No newline at end of file
......@@ -17,7 +17,9 @@
// the software.
//
// Created By : Michael Boniface
// Updated By : Simon Crowle
// Created Date : 18-12-2017
// Update Date : 14-02-2018
// Created for Project : FLAME
-->
......@@ -30,7 +32,45 @@ The following command brings up the services
`vagrant --infra=streaming up`
* 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:
### TO-DO: RE-FACTOR AUTOMATION FOR CONFIGURING KAPACITOR (kapacitor.conf)
Once Vagrant is finished, you will need to copy the kapacitor.conf file into clmc-service, then SSH in, configure Kapacitor and restart it:
```
# Copy the kapacitor.conf file in
vagrant plugin install vagrant-scp
vagrant scp ./test/streaming/kapacitor.conf clmc-service:/tmp/kapacitor.conf
# Configure and re-start kapacitor
vagrant --infra=streaming ssh clmc-service
sudo systemctl stop kapacitor
sudo mv /tmp/kapacitor.conf /etc/kapacitor/
sudo systemctl start kapacitor
exit
```
### Run the test set-up
```
cd ./test/streaming/
./setup.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
......@@ -51,29 +91,61 @@ The video should play.
### 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
* Name: Influx 1
* Telegraf database: CLMCMetrics
`SELECT mean("BytesPerSec") AS "mean_BytesPerSec" FROM "CLMCMetrics"."autogen"."apache" WHERE time > now() - 5m GROUP BY time(10s)`
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 or Apache2 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"
// Apache 1 rule
// -------------
var a1Data = batch
|query(''' SELECT mean("ReqPerSec") AS "mean_RPS" FROM "CLMCMetrics"."autogen"."apache" WHERE "ipendpoint"='adaptive_streaming_I1_apache1' ''')
.period(5s)
.every(5s)
var a1Alert = a1Data
|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' )
// Apache 2 rule
// -------------
var a2Data = batch
|query(''' SELECT mean("ReqPerSec") AS "mean_RPS" FROM "CLMCMetrics"."autogen"."apache" WHERE "ipendpoint"='adaptive_streaming_I1_apache2' ''')
.period(5s)
.every(5s)
var a2Alert = a2Data
|alert()
.id('{{ .Name }}/adaptive_streaming_I1_apache2')
.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
......
{
"id" : "Request_Rate_Alert_ApacheServers",
"type" : "batch",
"dbrps" : [{"db": "CLMCMetrics", "rp" : "autogen"}],
"script" : "\/\/ Apache 1 rule\r\n\/\/ -------------\r\nvar a1Data = 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 a1Alert = a1Data\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' )\r\n\r\n\/\/ Apache 2 rule\r\n\/\/ -------------\r\nvar a2Data = batch\r\n |query(''' SELECT mean(\"ReqPerSec\") AS \"mean_RPS\" FROM \"CLMCMetrics\".\"autogen\".\"apache\" WHERE \"ipendpoint\"='adaptive_streaming_I1_apache2' ''')\r\n .period(5s)\r\n .every(5s)\r\n\r\nvar a2Alert = a2Data\r\n |alert()\r\n .id('{{ .Name }}\/adaptive_streaming_I1_apache2')\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
#!/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 Influx data source
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/sources -d @./influx.json
# Set up Kapacitor
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/sources/1/kapacitors -d @./kapacitor.json
# Set up rules
curl -i -X POST -H "Content-Type: application/json" http://localhost:9092/kapacitor/v1/tasks -d @./rules.json
# Set up dashboard
curl -i -X POST -H "Content-Type: application/json" http://localhost:8888/chronograf/v1/dashboards -d @./dashboard.json
\ No newline at end of file
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