prod:telegraf_influx_sma_batterie_storage_sbs
Inhaltsverzeichnis
Die JSON Daten eines SMA Batterie Wechselrichters über Telegraf in die InfluxDB schreiben
Im Prinzip gleich wie bei Die Daten eines Shelly Plugs über Telegraf in die InfluxDB schreiben.
Der Trick ist der Parameter „insecure_skip_verify = true“ in der "[[inputs.http]]" Section um den Zertifkatfehler zu händelen.
Für das Parsen des JSON Datensatzes ist das Tool https://gjson.dev/ hilfreich
JSON aufrufen und Werte finden
Über die URL https://<SonnyBoyIP>/dyn/getDashValues.json lassen sich die Daten des Batterie Storages auslesen.
Ausgewertet werden soll der Ladezustand % und der aktuelle Ladung, der passenden Schlüssel über die Werte in der Startseite des Batterie Storages.
Konfiguration
Abgelegt unter /etc/telegraf/telegarf.d/sma_batterie.conf
# Configuration for sending metrics to InfluxDB [agent] round_interval=true interval="30s" [[outputs.influxdb]] urls = ["http://192.168.1.212:8086"] database = "SOLAR" # Send telegraf metrics also to file [[outputs.file]] ## Files to write to, "stdout" is a specially handled file. files = ["stdout", "/srv/telegraf/metrics_SMA_BAT_SOLAR.out"] ## Use batch serialization format instead of line based delimiting. The ## batch format allows for the production of non line based output formats and ## may more efficiently encode metric groups. # use_batch_format = false ## The file will be rotated after the time interval specified. When set ## to 0 no time based rotation is performed. rotation_interval = "1d" ## The logfile will be rotated when it becomes larger than the specified ## size. When set to 0 no size based rotation is performed. #rotation_max_size = "10MB" ## Maximum number of rotated archives to keep, any older logs are deleted. ## If set to -1, no archives are removed. rotation_max_archives = -1 ## Data format to output. data_format = "influx" # # Read SMA Batterie Storage [[inputs.http]] urls = [ "https://sma3012693486/dyn/getDashValues.json" ] method = "GET" insecure_skip_verify = true data_format = "json_v2" #tagexclude = [ "host","url"] [[inputs.http.json_v2]] measurement_name = "sma_bat_load" #timestamp_path = "unixtime" timestamp_format = "unix" timestamp_timezone = "Europe/Berlin" #-------------- Schlüssel [[inputs.http.json_v2.tag]] path = "result.0169-B3920DEE.6800_10821E00.7.#.val" rename = "sn" #-------------- Felder [[inputs.http.json_v2.field]] path = "result.0169-B3920DEE.6100_40263F00.7.#.val" rename = "akt_load" [[inputs.http.json_v2.field]] path = "result.0169-B3920DEE.6100_00295A00.7.#.val" rename = "total_load_status"
Quellen
prod/telegraf_influx_sma_batterie_storage_sbs.txt · Zuletzt geändert: 2023/12/20 10:41 von gpipperr