Takeout Grafana configuration from collector container and put in a separate container named postconfig
SMO-29
Signed-off-by: santanude <santanu.de@xoriant.com>
Change-Id: If9040bd9d62a9c07dce26b110dfa73bbba605038
Signed-off-by: santanude <santanu.de@xoriant.com>
+
# Copyright 2021 Xoriant Corporation\r
#\r
# Licensed under the Apache License, Version 2.0 (the "License");\r
cd kafka; make\r
cd dmaapadapter; make\r
cd influxdb-connector; make\r
+ cd postconfig; make
\r
run:\r
docker-compose up -d\r
echo; echo $config_file
cat $config_file
-echo; echo "wait for InfluxDB API at $ves_influxdb_host:$ves_influxdb_port"
-while ! curl http://$ves_influxdb_host:$ves_influxdb_port/ping ; do
- echo "InfluxDB API is not yet responding... waiting 10 seconds"
- sleep 10
-done
-
-echo; echo "setup veseventsdb in InfluxDB"
-# TODO: check if pre-existing and skip
-curl -X POST http://$ves_influxdb_host:$ves_influxdb_port/query \
- --data-urlencode "q=CREATE DATABASE veseventsdb"
-
-echo; echo "wait for Grafana API to be active"
-while ! curl http://$ves_grafana_host:$ves_grafana_port ; do
- echo "Grafana API is not yet responding... waiting 10 seconds"
- sleep 10
-done
-
-echo; echo "add VESEvents datasource to Grafana"
-# TODO: check if pre-existing and skip
-cat <<EOF >/opt/ves/datasource.json
-{ "name":"VESEvents",
- "type":"influxdb",
- "access":"direct",
- "url":"http://$ves_influxdb_host:$ves_influxdb_port",
- "password":"root",
- "user":"root",
- "database":"veseventsdb",
- "basicAuth":false,
- "basicAuthUser":"",
- "basicAuthPassword":"",
- "withCredentials":false,
- "isDefault":false,
- "jsonData":null
-}
-EOF
-
-curl -H "Accept: application/json" -H "Content-type: application/json" \
- -X POST -d @/opt/ves/datasource.json \
- http://$ves_grafana_auth@$ves_grafana_host:$ves_grafana_port/api/datasources
-
-echo; echo "add VES dashboard to Grafana"
-curl -H "Accept: application/json" -H "Content-type: application/json" \
- -X POST -d @/opt/ves/Dashboard.json \
- http://$ves_grafana_auth@$ves_grafana_host:$ves_grafana_port/api/dashboards/db
-
if [ "$ves_loglevel" != "" ]; then
python3 /opt/ves/evel-test-collector/code/collector/monitor.py \
--config /opt/ves/evel-test-collector/config/collector.conf \
container_name: smo-grafana
image: grafana/grafana:7.5.11
ports:
- - 8880:3000
+ - 3000:3000
networks:
- smo-net
depends_on:
ves_loglevel: "ERROR"
depends_on:
- smo-kafka
- - smo-influxdb
- - smo-grafana
smo-influxdb-connector:
container_name: smo-influxdb-connector
build: ./influxdb-connector
- 9300:9300
networks:
- smo-net
-
+ smo-post-config:
+ container_name: smo-post-config
+ build: ./postconfig
+ image: smo-post-config
+ environment:
+ ves_influxdb_host: "smo-influxdb"
+ ves_influxdb_port: "8086"
+ ves_grafana_host: "smo-grafana"
+ ves_grafana_port: "3000"
+ ves_grafana_auth: "admin:admin"
+ depends_on:
+ - smo-grafana
+ networks:
+ - smo-net
networks:
agent-net:
--- /dev/null
+# Copyright 2021 Xoriant Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM ubuntu:focal
+
+RUN apt-get update --fix-missing && apt-get -y upgrade
+RUN apt-get install -y git curl
+
+
+RUN mkdir /opt/ves
+
+RUN mkdir /opt/ves/grafana
+ADD grafana /opt/ves/grafana
+
+
+COPY start.sh /opt/ves/start.sh
+ENTRYPOINT ["/bin/bash", "/opt/ves/start.sh"]
--- /dev/null
+# Copyright 2021 Xoriant Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+default: all
+
+all:
+ docker build -t smo-post-config .
+
--- /dev/null
+{
+"dashboard": {
+ "description": "This Dashboard provides a general overview of a host, with templating to select the hostname.",
+ "editable": true,
+ "gnetId": null,
+ "graphTooltip": 0,
+ "hideControls": false,
+ "id": null,
+ "links": [],
+ "refresh": "10s",
+ "panels": [
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null
+ },
+ "gridPos": {
+ "h": 11,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "hiddenSeries": false,
+ "id": 3,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementload",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT moving_average(\"longTerm\", 5) AS \"alias\", moving_average(\"midTerm\", 5), moving_average(\"shortTerm\", 5) FROM \"measurementload\" WHERE (\"system\" =~ /^$host$/) AND $timeFilter GROUP BY \"system\"",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "longTerm"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Long Term"
+ ],
+ "type": "alias"
+ }
+ ],
+ [
+ {
+ "params": [
+ "midTerm"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Mid Term"
+ ],
+ "type": "alias"
+ }
+ ],
+ [
+ {
+ "params": [
+ "shortTerm"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Short Term"
+ ],
+ "type": "alias"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "host load",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Percent",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null
+ },
+ "gridPos": {
+ "h": 11,
+ "w": 12,
+ "x": 12,
+ "y": 0
+ },
+ "hiddenSeries": false,
+ "id": 6,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "cpuIdentifier"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementcpuusage",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT mean(\"cpusystem\") FROM \"cpu\" WHERE $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuUsageUser"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "host CPU Usage User",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Percent",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null
+ },
+ "gridPos": {
+ "h": 12,
+ "w": 12,
+ "x": 0,
+ "y": 11
+ },
+ "hiddenSeries": false,
+ "id": 2,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "nicIdentifier"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementnicperformance",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT moving_average(\"receivedTotalPacketsAccumulated\", 5) FROM \"measurementnicperformance\" WHERE (\"system\" =~ /^$host$/) AND $timeFilter GROUP BY \"system\", \"nicIdentifier\"",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "receivedTotalPacketsAccumulated"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Received Octets",
+ "tooltip": {
+ "shared": true,
+ "sort": 2,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null
+ },
+ "gridPos": {
+ "h": 12,
+ "w": 12,
+ "x": 12,
+ "y": 11
+ },
+ "hiddenSeries": false,
+ "id": 4,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "nicIdentifier"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementnicperformance",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "receivedOctetsAccumulated"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Transmitted Octets",
+ "tooltip": {
+ "shared": true,
+ "sort": 2,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 10,
+ "w": 12,
+ "x": 0,
+ "y": 23
+ },
+ "hiddenSeries": false,
+ "id": 7,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "diskIdentifier"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementdiskusage",
+ "orderByTime": "ASC",
+ "policy": "autogen",
+ "query": "SELECT moving_average(\"diskOpsWriteLast\", 5) FROM \"autogen\".\"diskUsage\" WHERE (\"system\" =~ /^$host$/ AND \"disk\" = 'sda') AND $timeFilter GROUP BY \"system\", \"disk\"",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "diskOpsWriteLast"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ },
+ {
+ "condition": "AND",
+ "key": "diskIdentifier",
+ "operator": "=",
+ "value": "sda"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Disk Usage SDA",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 10,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 10,
+ "w": 12,
+ "x": 12,
+ "y": 23
+ },
+ "hiddenSeries": false,
+ "id": 8,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "diskIdentifier"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementdiskusage",
+ "orderByTime": "ASC",
+ "policy": "autogen",
+ "query": "SELECT moving_average(\"diskOpsWriteLast\", 5) FROM \"autogen\".\"measurementdiskusage\" WHERE (\"system\" =~ /^$host$/ AND \"diskIdentifier\" = 'sdb') AND $timeFilter GROUP BY \"system\", \"diskIdentifier\"",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "diskOpsWriteLast"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ },
+ {
+ "condition": "AND",
+ "key": "diskIdentifier",
+ "operator": "=",
+ "value": "sdb"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Disk Usage SDB",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 10,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 7,
+ "w": 24,
+ "x": 0,
+ "y": 33
+ },
+ "hiddenSeries": false,
+ "id": 5,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "measurementmemoryusage",
+ "orderByTime": "ASC",
+ "policy": "autogen",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "memoryCached"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Memory Cached"
+ ],
+ "type": "alias"
+ }
+ ],
+ [
+ {
+ "params": [
+ "memoryUsed"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Memory Used"
+ ],
+ "type": "alias"
+ }
+ ],
+ [
+ {
+ "params": [
+ "memoryFree"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [
+ "5"
+ ],
+ "type": "moving_average"
+ },
+ {
+ "params": [
+ "Memory Free"
+ ],
+ "type": "alias"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Memory",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 10,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "VESEvents",
+ "fieldConfig": {
+ "defaults": {
+ "custom": {}
+ },
+ "overrides": []
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 7,
+ "w": 24,
+ "x": 0,
+ "y": 40
+ },
+ "hiddenSeries": false,
+ "id": 9,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "current",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "7.3.2",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "system"
+ ],
+ "type": "tag"
+ }
+ ],
+ "measurement": "fault",
+ "orderByTime": "ASC",
+ "policy": "autogen",
+ "query": "SELECT \"sequence\" FROM \"autogen\".\"fault\" WHERE (\"system\" =~ /^$host$/) AND $timeFilter GROUP BY \"system\"",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "sequence"
+ ],
+ "type": "field"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=~",
+ "value": "/^$host$/"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeRegions": [],
+ "timeShift": null,
+ "title": "Fault",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 10,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ }
+ ],
+ "refresh": "10s",
+ "schemaVersion": 26,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": [
+ {
+ "allValue": null,
+ "current": {
+ "selected": false,
+ "text": "All",
+ "value": "$__all"
+ },
+ "datasource": "VESEvents",
+ "definition": "",
+ "error": null,
+ "hide": 0,
+ "includeAll": true,
+ "label": "host",
+ "multi": true,
+ "name": "host",
+ "options": [],
+ "query": "SHOW TAG VALUES WITH KEY=system",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "tagValuesQuery": "",
+ "tags": [],
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ }
+ ]
+ },
+ "time": {
+ "from": "now-15m",
+ "to": "now"
+ },
+ "timepicker": {
+ "now": true,
+ "refresh_intervals": [
+ "10s",
+ "20s",
+ "30s",
+ "1m"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "timezone": "browser",
+ "title": "VES Demo",
+ "version": 4
+ }
+}
+
--- /dev/null
+{ "name":"VESEvents",
+ "type":"influxdb",
+ "access":"direct",
+ "url":"http://127.0.0.1:3330",
+ "password":"root",
+ "user":"root",
+ "database":"veseventsdb",
+ "basicAuth":false,
+ "basicAuthUser":"",
+ "basicAuthPassword":"",
+ "withCredentials":false,
+ "isDefault":false,
+ "jsonData":null
+}
--- /dev/null
+#!/bin/bash
+# Copyright 2021 Xoriant Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cd /opt/ves
+
+sleep 10
+
+
+echo; echo "Wait for Grafana API to be active"
+STARTTIME=$(date +%s)
+max_time=60
+while ! curl http://$ves_grafana_host:$ves_grafana_port/ping ;
+ do
+ ELAPSED_TIME=$(($(date +%s) - $STARTTIME))
+ if [ $ELAPSED_TIME -ge $max_time ]; then
+ echo "Grafana API is not yet up after several attempts! Exiting from script."
+ exit 1
+ fi
+ echo "Grafana API is not yet responding... waiting 10 seconds"
+ sleep 10
+ done
+ echo "Done."
+echo; echo "add VESEvents datasource to Grafana"
+
+
+# TODO: check if pre-existing and skip
+cat <<EOF >/opt/ves/grafana/datasource.json
+{ "name":"VESEvents",
+ "type":"influxdb",
+ "access":"direct",
+ "url":"http://$ves_influxdb_host:$ves_influxdb_port",
+ "password":"root",
+ "user":"root",
+ "database":"veseventsdb",
+ "basicAuth":false,
+ "basicAuthUser":"",
+ "basicAuthPassword":"",
+ "withCredentials":false,
+ "isDefault":false,
+ "jsonData":null
+}
+EOF
+
+curl -H "Accept: application/json" -H "Content-type: application/json" \
+ -X POST -d @/opt/ves/grafana/datasource.json \
+ http://$ves_grafana_auth@$ves_grafana_host:$ves_grafana_port/api/datasources
+
+echo; echo "add VES dashboard to Grafana"
+
+curl -H "Accept: application/json" -H "Content-type: application/json" \
+ -X POST -d @/opt/ves/grafana/dashboard.json \
+ http://$ves_grafana_auth@$ves_grafana_host:$ves_grafana_port/api/dashboards/db
+
+