diff --git a/GrafanaJMeterTemplate.json b/GrafanaJMeterTemplate.json index d887fc6..267a712 100755 --- a/GrafanaJMeterTemplate.json +++ b/GrafanaJMeterTemplate.json @@ -1,7 +1,9 @@ { + "dashboard": { + "__inputs": [ { - "name": "DS_JMETERDB", + "name": "jmeter", "label": "jmeterdb", "description": "", "type": "datasource", @@ -47,7 +49,7 @@ "type": "dashboard" }, { - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "enable": true, "iconColor": "rgb(237, 18, 18)", "iconSize": 17, @@ -103,7 +105,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "format": "none", @@ -222,7 +224,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "format": "none", @@ -348,7 +350,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)" ], - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "format": "percentunit", @@ -463,7 +465,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -597,7 +599,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "format": "none", @@ -702,7 +704,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -847,7 +849,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -985,7 +987,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -1137,7 +1139,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -1287,7 +1289,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "editable": true, "error": false, "fill": 1, @@ -1461,7 +1463,7 @@ { "allValue": ".*", "current": {}, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "hide": 0, "includeAll": false, "label": null, @@ -1534,7 +1536,7 @@ { "allValue": null, "current": {}, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "hide": 0, "includeAll": false, "label": null, @@ -1554,7 +1556,7 @@ { "allValue": ".*", "current": {}, - "datasource": "${DS_JMETERDB}", + "datasource": "jmeterdb", "hide": 0, "includeAll": true, "label": null, @@ -1606,4 +1608,17 @@ "title": "JMeter Metric Template", "uid": "ltaas", "version": 1 -} \ No newline at end of file + + }, + "overwrite": true, + "inputs": [ + { + "name": "jmeterdb", + "label": "jmeterdb", + "description": "", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ] +} diff --git a/README.md b/README.md index 5b1fec4..ec6891a 100755 --- a/README.md +++ b/README.md @@ -175,9 +175,6 @@ Normally you will set this via the Jmeter desktop application to make this easie Otherwise the graphs on Grafana may not show anything! -(10.) Import the sample jmeter Grafana dashboard (GrafanaJMeterTemplate.json) and select the InfluxDB datasource that was created. Check the progress of the test: - -![](img/test_progress.png) To learn more about the Grafana reporter module and how to make use of it, you can check the following blog post: diff --git a/initialize_cluster.sh b/initialize_cluster.sh index dd3384e..4b61893 100755 --- a/initialize_cluster.sh +++ b/initialize_cluster.sh @@ -50,4 +50,8 @@ kubectl -n $namespace exec -ti $master_pod -- chmod 755 /jmeter/load_test influxdb_svc=`kubectl -n $namespace get svc | grep influxdb | awk '{print $1}'` -kubectl -n $namespace exec -ti $grafana_pod -- curl 'http://admin:admin@127.0.0.1:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"jmeterdb","type":"influxdb","url":"http://'$influxdb_svc':8086","access":"proxy","isDefault":true,"database":"jmeter","user":"admin","password":"admin"}' \ No newline at end of file +kubectl -n $namespace exec -ti $grafana_pod -- curl 'http://admin:admin@127.0.0.1:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"jmeterdb","type":"influxdb","url":"http://'$influxdb_svc':8086","access":"proxy","isDefault":true,"database":"jmeter","user":"admin","password":"admin"}' + +#Import dashboard to grafana +kubectl -n $namespace cp GrafanaJMeterTemplate.json.json $grafana_pod:/tmp +kubectl -n $namespace exec -ti $grafana_pod -- curl -X POST -H "Content-Type: application/json" -d @/tmp/GrafanaJMeterTemplate.json.json "http://admin:admin@localhost:3000/api/dashboards/db"