-
-
Save niklibrato/d812095504d5fe5b1ffbfcb5d6765762 to your computer and use it in GitHub Desktop.
| [{"id":"cf452056.f2f35","type":"inject","z":"a2e7ef47.d8313","name":"measure_time","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":169.5,"y":119,"wires":[["71751e63.43b1c"]]},{"id":"71751e63.43b1c","type":"function","z":"a2e7ef47.d8313","name":"librato_payload","func":"function getRandomInt(min, max) { \n return Math.floor(Math.random() * (max - min +1)) + min; \n}\n\nvar value = getRandomInt(1, 10);\nvar measure_time = Math.round(msg.payload / 1000);\nmsg.payload = {\n \"gauges\": [\n {\n \"name\": \"random metric\",\n \"souce\": \"red-node-source\",\n \"value\": value,\n \"measure_time\": measure_time\n }\n ]\n};\nreturn msg;","outputs":1,"noerr":0,"x":427.5,"y":119,"wires":[["6d0496dc.fe1438"]]},{"id":"6d0496dc.fe1438","type":"http request","z":"a2e7ef47.d8313","name":"librato_post","method":"POST","ret":"txt","url":"https://metrics-api.librato.com/v1/metrics","x":718.5,"y":118,"wires":[[]]}] |
really strange - I can reproduce it. Here's the flow with the Librato module:
[{"id":"a5ead9d3.6b9fa8","type":"librato-config","z":"1c32e4ac.4bcf8b","name":"nik","email":"nik@wekwerth.net","source":"wunderground"},{"id":"4258f0e1.cc391","type":"inject","z":"1c32e4ac.4bcf8b","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":249,"y":294,"wires":[["bc1b4d90.f0a61"]]},{"id":"bc1b4d90.f0a61","type":"http request","z":"1c32e4ac.4bcf8b","name":"weather","method":"GET","ret":"obj","url":"http://api.wunderground.com/api/974f71223d4cb43d/conditions/q/54.301135,10.211759.json","x":458.5,"y":294,"wires":[["81a1e258.a6423"]]},{"id":"81a1e258.a6423","type":"function","z":"1c32e4ac.4bcf8b","name":"extract_temp","func":"var wundergroundResponse = msg.payload;\n\nmsg.payload = wundergroundResponse.current_observation.temp_c;\n\nreturn msg;","outputs":1,"noerr":0,"x":659.5,"y":292,"wires":[["c9f2528e.2b5d5","9d41ec84.8b6cd"]]},{"id":"c9f2528e.2b5d5","type":"librato","z":"1c32e4ac.4bcf8b","librato":"a5ead9d3.6b9fa8","metricName":"wunderground_tempreature","metricType":"gauge","x":938.5,"y":292,"wires":[]},{"id":"9d41ec84.8b6cd","type":"debug","z":"1c32e4ac.4bcf8b","name":"temperature","active":true,"console":"false","complete":"payload","x":870.5,"y":409,"wires":[]}]
Try this flow to reproduce the 504:
[{"id":"2c609f39.7d35e","type":"inject","z":"57427786.c154f8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":220,"wires":[["9c3d37a9.a65178"]]},{"id":"fd592bce.22ac58","type":"function","z":"57427786.c154f8","name":"create gauge","func":"var wundergroundResponse = msg.payload;\n\nvar timestamp = wundergroundResponse.current_observation.observation_epoch;\nvar temperature = wundergroundResponse.current_observation.temp_c;\n\nmsg.payload = {\n \"gauges\": [\n {\n \"name\": \"weather\",\n \"source\": \"wunderground\",\n \"value\": temperature,\n \"measure_time\": parseInt(timestamp)\n }\n ]\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":580,"y":220,"wires":[["72897d17.8f2f74","14f8e7c2.067c98"]]},{"id":"72897d17.8f2f74","type":"http request","z":"57427786.c154f8","name":"send gauge","method":"POST","ret":"txt","url":"https://metrics-api.librato.com/v1/metrics","x":790,"y":220,"wires":[["92b43832.a52828"]]},{"id":"92b43832.a52828","type":"debug","z":"57427786.c154f8","name":"","active":true,"console":"false","complete":"statusCode","x":1000,"y":220,"wires":[]},{"id":"9c3d37a9.a65178","type":"http request","z":"57427786.c154f8","name":"get temperature","method":"GET","ret":"obj","url":"http://api.wunderground.com/api/974f71223d4cb43d/conditions/q/54.301135,10.211759.json","x":360,"y":220,"wires":[["fd592bce.22ac58"]]},{"id":"14f8e7c2.067c98","type":"debug","z":"57427786.c154f8","name":"debug gauge","active":true,"console":"false","complete":"payload","x":800,"y":300,"wires":[]}]