generated from Randers-Kommune-Digitalisering/node-red-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flows.json
1 lines (1 loc) · 3.39 KB
/
flows.json
1
[{"id":"b0ce5617fde8f55b","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"ce2a41a16efa18ae","type":"MySQL-Connector","z":"b0ce5617fde8f55b","server":"172fa0ddaba0b3d3","name":"","x":1180,"y":340,"wires":[["945204ecb25923c6"]]},{"id":"2b65e0d8d46bdb26","type":"inject","z":"b0ce5617fde8f55b","name":"Create Table","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"CREATE TABLE if not exists data (time varchar(255), temp DOUBLE);","x":950,"y":180,"wires":[["ce2a41a16efa18ae"]]},{"id":"6223185ae7c6ab91","type":"http request","z":"b0ce5617fde8f55b","name":"Hent data","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://dmigw.govcloud.dk/v2/metObs/collections/observation/items/?stationId=06072¶meterId=temp_grass&limit=1","tls":"","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"X-Gravitee-Api-Key","valueType":"other","valueValue":"${API_KEY}"}],"x":760,"y":360,"wires":[["be51a70e65f4059a","945204ecb25923c6","77cb12f56c34a1e2"]]},{"id":"eefa9446290b0169","type":"inject","z":"b0ce5617fde8f55b","name":"Trigger","props":[],"repeat":"900","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":600,"y":360,"wires":[["6223185ae7c6ab91","5464e8c5896eaa9c"]]},{"id":"be51a70e65f4059a","type":"function","z":"b0ce5617fde8f55b","name":"Create SQL","func":"var data = msg.payload;\nmsg.topic = 'INSERT INTO data (time, temp) VALUES (:time, :temp);';\nmsg.payload = { time: data.features[0].properties.observed, temp: data.features[0].properties.value };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":360,"wires":[["ce2a41a16efa18ae"]]},{"id":"d48bbd03c8a51597","type":"prometheus-exporter","z":"b0ce5617fde8f55b","name":"Temp","metric":"ba95f6315465ff0c","x":1170,"y":500,"wires":[]},{"id":"945204ecb25923c6","type":"debug","z":"b0ce5617fde8f55b","name":"Log","active":true,"tosidebar":false,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1330,"y":440,"wires":[]},{"id":"77cb12f56c34a1e2","type":"function","z":"b0ce5617fde8f55b","name":"Create Prometheus","func":"var data = msg.payload;\nmsg.payload =\n{\n \"op\": \"set\",\n \"val\": data.features[0].properties.value,\n \"labels\": {\n \"location\": \"Spørring\"\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":500,"wires":[["d48bbd03c8a51597"]]},{"id":"8f97bba5e7b24e18","type":"prometheus-exporter","z":"b0ce5617fde8f55b","name":"Up","metric":"964c4653bf1162b9","x":1170,"y":580,"wires":[]},{"id":"5464e8c5896eaa9c","type":"function","z":"b0ce5617fde8f55b","name":"Create Up Metric","func":"msg.payload =\n{\n \"op\": \"set\",\n \"val\": 1,\n \"labels\": {\n \"name\": env.get('POD_NAME')\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":580,"wires":[["8f97bba5e7b24e18"]]},{"id":"172fa0ddaba0b3d3","type":"MySQL-Server-Connector","name":"MariaDB","host":"${DB_HOST}","port":"${DB_PORT}","user":"${DB_USER}","password":"${DB_PASS}","tls":false,"database":"${DB_DATABASE}"},{"id":"ba95f6315465ff0c","type":"prometheus-metric-config","name":"Temp","help":"temp","labels":"location","mtype":"gauge"},{"id":"964c4653bf1162b9","type":"prometheus-metric-config","name":"Up","help":"Up","labels":"name","mtype":"gauge"}]