From f41c3f2a28fc194d6a484edfccdf93ad1e243309 Mon Sep 17 00:00:00 2001
From: Stephen C Phillips <steve@scphillips.com>
Date: Fri, 15 Jun 2018 17:33:57 +0100
Subject: [PATCH] WIP: adds derivative of total bytes sent/recv across nginx
 endpoints

minio still to do
---
 .../workshopdemo/dashboards/sf_dash.json      | 240 +++++++++++++++++-
 1 file changed, 230 insertions(+), 10 deletions(-)

diff --git a/src/test/clmctest/workshopdemo/dashboards/sf_dash.json b/src/test/clmctest/workshopdemo/dashboards/sf_dash.json
index 3ee770c..a243b4e 100644
--- a/src/test/clmctest/workshopdemo/dashboards/sf_dash.json
+++ b/src/test/clmctest/workshopdemo/dashboards/sf_dash.json
@@ -2,7 +2,227 @@
   "id": 2,
   "cells": [
     {
-      "i": "104287f1-29f1-4257-9991-edc8627e7abf",
+      "i": "dd7693ca-0622-41f0-9f2c-d9a468434097",
+      "x": 0,
+      "y": 8,
+      "w": 5,
+      "h": 4,
+      "name": "Nginx network average MB/s sent/recv for nginx service-function",
+      "queries": [
+        {
+          "query": "select derivative(total_RX_MB, 1m) / 60 as RX_MB_per_s, derivative(total_TX_MB, 1m) / 60 as TX_MB_per_s from (select sum(RX_MB) as total_RX_MB, sum(TX_MB) as total_TX_MB from (SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)) group by time(1m)) ",
+          "queryConfig": {
+            "database": "",
+            "measurement": "",
+            "retentionPolicy": "",
+            "fields": [],
+            "tags": {},
+            "groupBy": {
+              "time": "",
+              "tags": []
+            },
+            "areTagsAccepted": false,
+            "rawText": "select derivative(total_RX_MB, 1m) / 60 as RX_MB_per_s, derivative(total_TX_MB, 1m) / 60 as TX_MB_per_s from (select sum(RX_MB) as total_RX_MB, sum(TX_MB) as total_TX_MB from (SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)) group by time(1m)) ",
+            "range": null,
+            "shifts": null
+          },
+          "source": "/chronograf/v1/sources/2"
+        }
+      ],
+      "axes": {
+        "x": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        },
+        "y": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "Mb / sec",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        },
+        "y2": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        }
+      },
+      "type": "line-stepplot",
+      "colors": [
+        {
+          "id": "2f5981b6-6f85-4efc-989c-9da90fe54189",
+          "type": "scale",
+          "hex": "#31C0F6",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        },
+        {
+          "id": "696e12a0-4b7d-4a8f-9d95-a5be5ef3e8b8",
+          "type": "scale",
+          "hex": "#A500A5",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        },
+        {
+          "id": "f3788c7b-bdbe-4d14-8439-c6f3b4db75e9",
+          "type": "scale",
+          "hex": "#FF7E27",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        }
+      ],
+      "legend": {},
+      "tableOptions": {
+        "timeFormat": "MM/DD/YYYY HH:mm:ss",
+        "verticalTimeAxis": true,
+        "sortBy": {
+          "internalName": "time",
+          "displayName": "",
+          "visible": true
+        },
+        "wrapping": "truncate",
+        "fieldNames": [
+          {
+            "internalName": "time",
+            "displayName": "",
+            "visible": true
+          }
+        ],
+        "fixFirstColumn": true
+      },
+      "links": {
+        "self": "/chronograf/v1/dashboards/2/cells/dd7693ca-0622-41f0-9f2c-d9a468434097"
+      }
+    },
+    {
+      "i": "419b4e3c-1ca3-49ac-bc91-410bfbeb879a",
+      "x": 0,
+      "y": 4,
+      "w": 5,
+      "h": 4,
+      "name": "Nginx network MB sent/recv total for nginx service-function",
+      "queries": [
+        {
+          "query": "select sum(RX_MB) as total_RX_MB, sum(TX_MB) as total_TX_MB from (SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)) group by time(1m)",
+          "queryConfig": {
+            "database": "",
+            "measurement": "",
+            "retentionPolicy": "",
+            "fields": [],
+            "tags": {},
+            "groupBy": {
+              "time": "",
+              "tags": []
+            },
+            "areTagsAccepted": false,
+            "rawText": "select sum(RX_MB) as total_RX_MB, sum(TX_MB) as total_TX_MB from (SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)) group by time(1m)",
+            "range": null,
+            "shifts": null
+          },
+          "source": "/chronograf/v1/sources/2"
+        }
+      ],
+      "axes": {
+        "x": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        },
+        "y": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "MB",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        },
+        "y2": {
+          "bounds": [
+            "",
+            ""
+          ],
+          "label": "",
+          "prefix": "",
+          "suffix": "",
+          "base": "10",
+          "scale": "linear"
+        }
+      },
+      "type": "line-stepplot",
+      "colors": [
+        {
+          "id": "2f5981b6-6f85-4efc-989c-9da90fe54189",
+          "type": "scale",
+          "hex": "#31C0F6",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        },
+        {
+          "id": "696e12a0-4b7d-4a8f-9d95-a5be5ef3e8b8",
+          "type": "scale",
+          "hex": "#A500A5",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        },
+        {
+          "id": "f3788c7b-bdbe-4d14-8439-c6f3b4db75e9",
+          "type": "scale",
+          "hex": "#FF7E27",
+          "name": "Nineteen Eighty Four",
+          "value": "0"
+        }
+      ],
+      "legend": {},
+      "tableOptions": {
+        "timeFormat": "MM/DD/YYYY HH:mm:ss",
+        "verticalTimeAxis": true,
+        "sortBy": {
+          "internalName": "time",
+          "displayName": "",
+          "visible": true
+        },
+        "wrapping": "truncate",
+        "fieldNames": [
+          {
+            "internalName": "time",
+            "displayName": "",
+            "visible": true
+          }
+        ],
+        "fixFirstColumn": true
+      },
+      "links": {
+        "self": "/chronograf/v1/dashboards/2/cells/419b4e3c-1ca3-49ac-bc91-410bfbeb879a"
+      }
+    },
+    {
+      "i": "ada5c993-47e3-479a-8e74-3000125f819d",
       "x": 5,
       "y": 0,
       "w": 5,
@@ -108,19 +328,19 @@
         "fixFirstColumn": true
       },
       "links": {
-        "self": "/chronograf/v1/dashboards/2/cells/104287f1-29f1-4257-9991-edc8627e7abf"
+        "self": "/chronograf/v1/dashboards/2/cells/ada5c993-47e3-479a-8e74-3000125f819d"
       }
     },
     {
-      "i": "d9b2bb28-e4d0-4135-9b19-a42cb2bcdeb8",
+      "i": "22298fa4-a5e1-4cb5-869c-6754b06fa857",
       "x": 0,
       "y": 0,
       "w": 5,
       "h": 4,
-      "name": "Nginx network",
+      "name": "Nginx network MB sent/recv by endpoint",
       "queries": [
         {
-          "query": "SELECT non_negative_derivative(mean(\"bytes_recv\")) / 30000000 AS \"RX_Mb_per_second\", non_negative_derivative(mean(\"bytes_sent\")) / 30000000 AS \"TX_Mb_per_second\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m) FILL(null)",
+          "query": "SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)",
           "queryConfig": {
             "database": "",
             "measurement": "",
@@ -132,11 +352,11 @@
               "tags": []
             },
             "areTagsAccepted": false,
-            "rawText": "SELECT non_negative_derivative(mean(\"bytes_recv\")) / 30000000 AS \"RX_Mb_per_second\", non_negative_derivative(mean(\"bytes_sent\")) / 30000000 AS \"TX_Mb_per_second\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m) FILL(null)",
+            "rawText": "SELECT last(\"bytes_recv\") / 1048576 AS \"RX_MB\", last(\"bytes_sent\") / 1048576 AS \"TX_MB\" FROM \"MSDemo\".\"autogen\".\"net\" WHERE time > :dashboardTime: AND \"sf\"='nginx' GROUP BY time(1m), ipendpoint FILL(null)",
             "range": null,
             "shifts": null
           },
-          "source": "/chronograf/v1/sources/1"
+          "source": "/chronograf/v1/sources/2"
         }
       ],
       "axes": {
@@ -156,7 +376,7 @@
             "",
             ""
           ],
-          "label": "Mb / sec",
+          "label": "MB",
           "prefix": "",
           "suffix": "",
           "base": "10",
@@ -174,7 +394,7 @@
           "scale": "linear"
         }
       },
-      "type": "line",
+      "type": "line-stepplot",
       "colors": [
         {
           "id": "2f5981b6-6f85-4efc-989c-9da90fe54189",
@@ -218,7 +438,7 @@
         "fixFirstColumn": true
       },
       "links": {
-        "self": "/chronograf/v1/dashboards/2/cells/d9b2bb28-e4d0-4135-9b19-a42cb2bcdeb8"
+        "self": "/chronograf/v1/dashboards/2/cells/22298fa4-a5e1-4cb5-869c-6754b06fa857"
       }
     }
   ],
-- 
GitLab