Closed meltaxa closed 3 years ago
Code to output a json file:
f = open('solariot.json','w')
f.write(json.dumps(inverter))
f.close()
The use case of Telegraf ingesting the json allows Telegraf to handle external communications, say to InfluxDB. Telegraf should cache the input and is more resilient to network comms failures.
Sample telegraf conf.d file for those interested:
[[outputs.influxdb_v2]]
urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
token = "SECRET!"
organization = "MyOrg"
bucket = "Your Bucket"
[outputs.influxdb.tagpass]
influxdb_database = ["sungrow"]
[[inputs.exec]]
commands = [
"cat /path/to/solariot.json"
]
interval = "30s"
timeout = "15s"
data_format = "json"
[inputs.exec.tags]
influxdb_database = "sungrow"
The exposed json endpoint can also be used by other services that allow json parsing, such as a Momentum dashboard:
Enhancement to send output to a file in json format. Use case could be for a telegraf process to ingest this as input.