In case anyone wants to send fields and tags into Graphite, here is a sample flow using the fields temperature
and humidity
and the tags kitchen
and basement
.
[{"id":"018b2e9311f9102f","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"field","payload":"76","payloadType":"num","x":230,"y":140,"wires":[["8360371aecdeedd7"]]},{"id":"26dc41e58f0ae76a","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tag","payload":"kitchen","payloadType":"str","x":220,"y":200,"wires":[["8360371aecdeedd7"]]},{"id":"8360371aecdeedd7","type":"join","z":"d1c87ae83bc41c60","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":160,"wires":[["761b71bf3299516d","f5bd3f179bf7d970"]]},{"id":"f5bd3f179bf7d970","type":"function","z":"d1c87ae83bc41c60","name":"temperature","func":"var client = graphite.createClient('http://localhost');\n\nvar metrics = { temperature: msg.payload.field };\nclient.write(metrics, function (err) {\n // if err is null, your data was sent to graphite!\n});\nvar tags = { 'room': msg.payload.tag };\nclient.writeTagged(metrics, tags, function (err) {\n // if err is null, your data was sent to graphite!\n});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"graphite","module":"graphite"}],"x":670,"y":160,"wires":[["b418ad50d7acd19e"]]},{"id":"b418ad50d7acd19e","type":"debug","z":"d1c87ae83bc41c60","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":160,"wires":[]},{"id":"761b71bf3299516d","type":"debug","z":"d1c87ae83bc41c60","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":200,"wires":[]},{"id":"c907ffb8790843d8","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"field","payload":"67","payloadType":"num","x":230,"y":280,"wires":[["48c62bb750bb8215"]]},{"id":"16d38e28389bda55","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tag","payload":"basement","payloadType":"str","x":215,"y":336,"wires":[["48c62bb750bb8215"]]},{"id":"48c62bb750bb8215","type":"join","z":"d1c87ae83bc41c60","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":300,"wires":[["e8e228b0db792efb","59dd5a55f5e267ca"]]},{"id":"59dd5a55f5e267ca","type":"function","z":"d1c87ae83bc41c60","name":"temperature","func":"var client = graphite.createClient('http://localhost');\n\nvar metrics = { temperature: msg.payload.field };\nclient.write(metrics, function (err) {\n // if err is null, your data was sent to graphite!\n});\nvar tags = { 'room': msg.payload.tag };\nclient.writeTagged(metrics, tags, function (err) {\n // if err is null, your data was sent to graphite!\n});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"graphite","module":"graphite"}],"x":680,"y":300,"wires":[["e9405e9ad624500f"]]},{"id":"e9405e9ad624500f","type":"debug","z":"d1c87ae83bc41c60","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":300,"wires":[]},{"id":"e8e228b0db792efb","type":"debug","z":"d1c87ae83bc41c60","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":685,"y":336,"wires":[]},{"id":"2fc8e4f361ac3191","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"field","payload":"41","payloadType":"num","x":210,"y":500,"wires":[["eb2eb3f2df63881c"]]},{"id":"df6a6a624fc6b877","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tag","payload":"kitchen","payloadType":"str","x":200,"y":560,"wires":[["eb2eb3f2df63881c"]]},{"id":"eb2eb3f2df63881c","type":"join","z":"d1c87ae83bc41c60","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":520,"wires":[["f38a3ab4453ec72a","c7502d45273d040e"]]},{"id":"c7502d45273d040e","type":"function","z":"d1c87ae83bc41c60","name":"humidity","func":"var client = graphite.createClient('http://localhost');\n\nvar metrics = { humidity: msg.payload.field };\nclient.write(metrics, function (err) {\n // if err is null, your data was sent to graphite!\n});\nvar tags = { 'room': msg.payload.tag };\nclient.writeTagged(metrics, tags, function (err) {\n // if err is null, your data was sent to graphite!\n});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"graphite","module":"graphite"}],"x":640,"y":520,"wires":[["2b979d8421835efc"]]},{"id":"2b979d8421835efc","type":"debug","z":"d1c87ae83bc41c60","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":520,"wires":[]},{"id":"f38a3ab4453ec72a","type":"debug","z":"d1c87ae83bc41c60","name":"debug 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":560,"wires":[]},{"id":"85cd83cb406bcc2e","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"field","payload":"54","payloadType":"num","x":210,"y":640,"wires":[["f32ad0b6ace1b8a1"]]},{"id":"049bd3fc819e32dd","type":"inject","z":"d1c87ae83bc41c60","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tag","payload":"basement","payloadType":"str","x":195,"y":696,"wires":[["f32ad0b6ace1b8a1"]]},{"id":"f32ad0b6ace1b8a1","type":"join","z":"d1c87ae83bc41c60","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":660,"wires":[["813823ad5cc66aba","80a59bdbe37854b0"]]},{"id":"80a59bdbe37854b0","type":"function","z":"d1c87ae83bc41c60","name":"humidity","func":"var client = graphite.createClient('http://localhost');\n\nvar metrics = { humidity: msg.payload.field };\nclient.write(metrics, function (err) {\n // if err is null, your data was sent to graphite!\n});\nvar tags = { 'room': msg.payload.tag };\nclient.writeTagged(metrics, tags, function (err) {\n // if err is null, your data was sent to graphite!\n});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"graphite","module":"graphite"}],"x":650,"y":660,"wires":[["0b985e785fb07972"]]},{"id":"0b985e785fb07972","type":"debug","z":"d1c87ae83bc41c60","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":660,"wires":[]},{"id":"813823ad5cc66aba","type":"debug","z":"d1c87ae83bc41c60","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":665,"y":696,"wires":[]}]
In Grafana's query editor, the nomenclature is as follows:
fieldname;tagname=tagvalue
example: humidity;room=basement