aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrivahni <srivahni.chivukula@intel.com>2019-07-17 00:31:28 -0700
committerSrivahni <srivahni.chivukula@intel.com>2019-07-17 00:39:56 -0700
commitd372a21027f5ade64e2c28037c1deab053b5e36e (patch)
tree609d93cc3f125bdb065f50770352382e4d27d140
parent1ef3f0f57769f91ba2e85b9c2b42368646d483af (diff)
Automate datasource & dashboard imports in grafana
Added to grafana-values.yaml Issue-ID: ONAPARC-393 Signed-off-by: Srivahni <srivahni.chivukula@intel.com> Change-Id: Id6c8413ea4c4ea69cc7b35f52c2f47b364f5906f
-rwxr-xr-xvnfs/DAaaS/deploy/visualization/README.txt14
-rwxr-xr-xvnfs/DAaaS/deploy/visualization/charts/grafana/dashboards/dashboard1.json145
-rwxr-xr-xvnfs/DAaaS/deploy/visualization/charts/grafana/grafana-values.yaml39
-rwxr-xr-xvnfs/DAaaS/deploy/visualization/charts/grafana/templates/configmap-add-dashboard.yaml11
-rwxr-xr-xvnfs/DAaaS/deploy/visualization/charts/grafana/values.yaml13
5 files changed, 210 insertions, 12 deletions
diff --git a/vnfs/DAaaS/deploy/visualization/README.txt b/vnfs/DAaaS/deploy/visualization/README.txt
new file mode 100755
index 00000000..a2005d29
--- /dev/null
+++ b/vnfs/DAaaS/deploy/visualization/README.txt
@@ -0,0 +1,14 @@
+#Add datasource
+Modify "url" in the datasources section of ./charts/grafana/grafana-values.yaml based on the Prometheus or any other service created
+
+#copy the custom dashboards definition into the folder ./charts/grafana/dashboards
+Example,
+ cp ~/dashboard1.json ./charts/grafana/dashboards/
+
+#create configmap that imports .json file as config
+configmap found at ./charts/grafana/templates/configmap-add-dashboard.yaml
+
+#Install visualization helm package
+
+helm install -n graf-prometheus . -f ./charts/grafana/values.yaml -f ./charts/grafana/grafana-values.yaml
+
diff --git a/vnfs/DAaaS/deploy/visualization/charts/grafana/dashboards/dashboard1.json b/vnfs/DAaaS/deploy/visualization/charts/grafana/dashboards/dashboard1.json
new file mode 100755
index 00000000..3726721c
--- /dev/null
+++ b/vnfs/DAaaS/deploy/visualization/charts/grafana/dashboards/dashboard1.json
@@ -0,0 +1,145 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": "-- Grafana --",
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "gnetId": null,
+ "graphTooltip": 0,
+ "id": null,
+ "links": [],
+ "panels": [
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "Prometheus",
+ "fill": 1,
+ "gridPos": {
+ "h": 9,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "$$hashKey": "object:277",
+ "expr": "collectd_cpu_percent",
+ "format": "time_series",
+ "instant": false,
+ "intervalFactor": 1,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Panel Title",
+ "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": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ }
+ ],
+ "schemaVersion": 16,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": []
+ },
+ "time": {
+ "from": "now-6h",
+ "to": "now"
+ },
+ "timepicker": {
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "timezone": "",
+ "title": "New dashboard",
+ "uid": null,
+ "version": 0
+}
diff --git a/vnfs/DAaaS/deploy/visualization/charts/grafana/grafana-values.yaml b/vnfs/DAaaS/deploy/visualization/charts/grafana/grafana-values.yaml
new file mode 100755
index 00000000..cf04bc8c
--- /dev/null
+++ b/vnfs/DAaaS/deploy/visualization/charts/grafana/grafana-values.yaml
@@ -0,0 +1,39 @@
+grafana:
+# nodeSelector:
+# vcmtspktgen: "true"
+
+ datasources:
+ datasources.yaml:
+ apiVersion: 1
+ datasources:
+ - name: Prometheus
+ type: prometheus
+ url: http://cp-prometheus-prometheus.edge1:9090
+ isDefault: true
+ access: proxy
+
+ adminPassword: admin
+
+ image:
+ tag: 5.1.4
+
+ service:
+ type: NodePort
+ # nodePort: 17765
+
+ # Customer DashBoards configurations
+ dashboardProviders:
+ dashboardproviders.yaml:
+ apiVersion: 1
+ providers:
+ - name: 'dashboard1'
+ orgId: 1
+ folder: ''
+ type: file
+ disableDeletion: false
+ editable: true
+ options:
+ path: /var/lib/grafana/dashboards/dashboard1
+
+ dashboardsConfigMaps:
+ dashboard1: "custom-dashboard1"
diff --git a/vnfs/DAaaS/deploy/visualization/charts/grafana/templates/configmap-add-dashboard.yaml b/vnfs/DAaaS/deploy/visualization/charts/grafana/templates/configmap-add-dashboard.yaml
new file mode 100755
index 00000000..d125f875
--- /dev/null
+++ b/vnfs/DAaaS/deploy/visualization/charts/grafana/templates/configmap-add-dashboard.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: custom-dashboard1
+ labels:
+ app: {{ template "grafana.name" . }}
+ chart: {{ template "grafana.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+data:
+{{ (.Files.Glob "dashboards/dashboard1.json").AsConfig | indent 2 }}
diff --git a/vnfs/DAaaS/deploy/visualization/charts/grafana/values.yaml b/vnfs/DAaaS/deploy/visualization/charts/grafana/values.yaml
index 74b511cf..582c010c 100755
--- a/vnfs/DAaaS/deploy/visualization/charts/grafana/values.yaml
+++ b/vnfs/DAaaS/deploy/visualization/charts/grafana/values.yaml
@@ -208,18 +208,7 @@ plugins: []
## Configure grafana datasources
## ref: http://docs.grafana.org/administration/provisioning/#datasources
##
-datasources:
- datasources.yaml:
- apiVersion: 1
- datasources:
- - name: Prometheus
- type: prometheus
- url: http://localhost:9090
- isDefault: true
- - name: M3DB
- type: prometheus
- url: http://m3coordinator-m3db-cluster.edge1.svc.cluster.local:7201
- access: proxy
+#datasources:
## Configure notifiers
## ref: http://docs.grafana.org/administration/provisioning/#alert-notification-channels