/
dashboard.json
1 lines (1 loc) · 6.78 KB
/
dashboard.json
1
[{"id":"14a6b72.f6e6f49","type":"tab","label":"grafana"},{"id":"70c6bb72.1bb774","type":"function","z":"14a6b72.f6e6f49","name":"Add dashboard","func":"msg.payload=\n{\n \"dashboard\": {\n \"id\": null,\n \"title\": \"Data evolution\",\n \"tags\": [ \"templated\" ],\n \"timezone\": \"browser\",\n \"schemaVersion\": 6,\n \"version\": 0,\n \"rows\":[]\n },\n \"overwrite\": true\n}\nreturn msg;","outputs":1,"noerr":0,"x":486.4998474121094,"y":432,"wires":[["7c4e8b38.440ae4"]]},{"id":"5d58c264.909e4c","type":"inject","z":"14a6b72.f6e6f49","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":175.4999237060547,"y":190,"wires":[["4129f2eb.20bdec"]]},{"id":"32de288d.5cee98","type":"http request","z":"14a6b72.f6e6f49","name":"Create datasource","method":"POST","ret":"txt","url":"visualisation:3000/api/datasources","tls":"","x":702.4999237060547,"y":164,"wires":[["4c1b908f.6a3c9"]]},{"id":"4129f2eb.20bdec","type":"function","z":"14a6b72.f6e6f49","name":"set datasource settings","func":"msg.payload =\n{\n \"name\":\"my_datasource\",\n \"type\":\"influxdb\",\n \"url\":\"http://bd:8086\",\n \"access\":\"proxy\",\n \"basicAuth\":false,\n \"database\":\"mydb\"\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"x":423.4999237060547,"y":148,"wires":[["32de288d.5cee98"]]},{"id":"4c1b908f.6a3c9","type":"debug","z":"14a6b72.f6e6f49","name":"","active":true,"console":"false","complete":"payload","x":962.8332977294922,"y":134.33328247070312,"wires":[]},{"id":"e073d8b5.ba1158","type":"inject","z":"14a6b72.f6e6f49","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":141.4999542236328,"y":428,"wires":[["51829cba.6600f4"]]},{"id":"a9c37167.2a204","type":"http request","z":"14a6b72.f6e6f49","name":"Create dashboards","method":"POST","ret":"txt","url":"visualisation:3000/api/dashboards/db","tls":"","x":752.4999847412109,"y":379,"wires":[["f569d349.3182e"]]},{"id":"51829cba.6600f4","type":"influxdb in","z":"14a6b72.f6e6f49","influxdb":"cbfba93b.4c9438","name":"Get all measurements","query":"SHOW MEASUREMENTS","x":268.8956298828125,"y":494.8888854980469,"wires":[["e7ab714c.1343d"]]},{"id":"7c4e8b38.440ae4","type":"function","z":"14a6b72.f6e6f49","name":"Add rows","func":"\nvar rows = [];\n\nvar row_template;\n\nvar measurements = flow.get(\"measurements\");\n\nfor (var i=0; i<measurements.length; i++){\n row_template = {\"collapse\": false,\n \"height\": \"250px\",\n \"panels\": [\n {\n \"aliasColors\": {},\n \"bars\": false,\n \"datasource\": \"my_datasource\",\n \"fill\": 1,\n \"id\": 1,\n \"legend\": {\n \"avg\": false,\n \"current\": false,\n \"max\": false,\n \"min\": false,\n \"show\": true,\n \"total\": false,\n \"values\": false\n },\n \"lines\": true,\n \"linewidth\": 1,\n \"links\": [],\n \"nullPointMode\": \"null\",\n \"percentage\": false,\n \"pointradius\": 5,\n \"points\": false,\n \"renderer\": \"flot\",\n \"seriesOverrides\": [],\n \"span\": 12,\n \"stack\": false,\n \"steppedLine\": false,\n \"targets\": [\n {\n \"dsType\": \"influxdb\",\n \"groupBy\": [\n {\n \"params\": [\n \"$interval\"\n ],\n \"type\": \"time\"\n },\n {\n \"params\": [\n \"null\"\n ],\n \"type\": \"fill\"\n }\n ],\n \"policy\": \"default\",\n \"query\": \"SELECT * FROM \\\"2308\\\"\",\n \"rawQuery\": true,\n \"refId\": \"A\",\n \"resultFormat\": \"time_series\",\n \"select\": [\n [\n {\n \"params\": [\n \"value\"\n ],\n \"type\": \"field\"\n },\n {\n \"params\": [],\n \"type\": \"mean\"\n }\n ]\n ],\n \"tags\": []\n }\n ],\n \"thresholds\": [],\n \"timeFrom\": null,\n \"timeShift\": null,\n \"title\": \"Panel Title\",\n \"tooltip\": {\n \"shared\": true,\n \"sort\": 0,\n \"value_type\": \"individual\"\n },\n \"type\": \"graph\",\n \"xaxis\": {\n \"mode\": \"time\",\n \"name\": null,\n \"show\": true,\n \"values\": []\n },\n \"yaxes\": [\n {\n \"format\": \"short\",\n \"label\": null,\n \"logBase\": 1,\n \"max\": null,\n \"min\": null,\n \"show\": true\n },\n {\n \"format\": \"short\",\n \"label\": null,\n \"logBase\": 1,\n \"max\": null,\n \"min\": null,\n \"show\": true\n }\n ]\n }\n ],\n \"repeat\": null,\n \"repeatIteration\": null,\n \"repeatRowId\": null,\n \"showTitle\": false,\n \"title\": \"Dashboard Row\",\n \"titleSize\": \"h6\"\n };\n row_template.panels[0].targets[0].query = \"SELECT \\\"value\\\" FROM \\\"\"+measurements[i].name+\"\\\"\";\n row_template.panels[0].title = measurements[i].name;\n rows.push(row_template);\n}\n\nmsg.payload.dashboard.rows = rows;\n \nreturn msg;","outputs":1,"noerr":0,"x":610.9513397216797,"y":496.5486145019531,"wires":[["a9c37167.2a204"]]},{"id":"e7ab714c.1343d","type":"change","z":"14a6b72.f6e6f49","name":"","rules":[{"t":"set","p":"measurements","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":322.94786071777344,"y":542.7708740234375,"wires":[["70c6bb72.1bb774"]]},{"id":"f569d349.3182e","type":"debug","z":"14a6b72.f6e6f49","name":"","active":true,"console":"false","complete":"payload","x":974.8957977294922,"y":403.8888854980469,"wires":[]},{"id":"94ef0def.b4097","type":"comment","z":"14a6b72.f6e6f49","name":"CREATE GRAFANA DATASOURCE","info":"","x":517.9409637451172,"y":77.0451431274414,"wires":[]},{"id":"4ab4b390.b9285c","type":"comment","z":"14a6b72.f6e6f49","name":"CREATE GRAPHS DYNAMICALLY","info":"","x":508.94444274902344,"y":315.0486145019531,"wires":[]},{"id":"cbfba93b.4c9438","type":"influxdb","z":"","hostname":"bd","port":"8086","protocol":"http","database":"mydb","name":"","usetls":false,"tls":""}]