Sonoff mqtt json parsing to influxdb

I am new to telegraf and json and I know this is easy but I was having difficulty figuring it out. I tried searching and it seems it is just too simple and I am not sure what I am missing (just experience with these systems). I have a sensor that is outputting json strings with some status formation but I dont know how to setup telegraf to output this info to influx. the json string is like this:

{“Status”:{“Module”:17,“FriendlyName”:“Eco_dht11”,“Topic”:“Eco_dht11”,“ButtonTopic”:“0”,“Power”:1,“PowerOnState”:3,“LedState”:1,“SaveData”:1,“SaveState”:1,“ButtonRetain”:0,“PowerRetain”:0}}

{“StatusPRM”:{“Baudrate”:115200,“GroupTopic”:“sonoffs”,“OtaUrl”:“sonoff”,“Uptime”:18,“Sleep”:0,“BootCount”:17,“SaveCount”:86,“SaveAddress”:“3F6000”}}
{“StatusFWR”:{“Version”:“5.10.0a”,“BuildDateTime”:“2017-12-17T00:05:41”,“Boot”:2,“Core”:“2_3_0”,“SDK”:“1.5.3(aec24ac9)”}}
{“StatusLOG”:{“SerialLog”:2,“WebLog”:2,“SysLog”:0,“LogHost”:"",“LogPort”:514,“SSId1”:“SSID1”,“SSId2”:“SSID2”,“TelePeriod”:300,“SetOption”:“00000109”}}
{“StatusMEM”:{“ProgramSize”:476,“Free”:544,“Heap”:23,“ProgramFlashSize”:4096,“FlashSize”:1024,“FlashMode”:2}}
{“StatusNET”:{“Hostname”:“Eco_dht11-5080”,“IPAddress”:“192.168.1.106”,“Gateway”:“192.168.1.1”,“Subnetmask”:“255.255.255.0”,“DNSServer”:“192.168.1.1”,“Mac”:“XX:XX:XX:XX:XX:XX”,“Webserver”:2,“WifiConfig”:2}}
{“StatusMQT”:{“MqttHost”:“192.168.1.6”,“MqttPort”:1883,“MqttClientMask”:“DVES_%06X”,“MqttClient”:“DVES_01D3D8”,“MqttUser”:"",“MAX_PACKET_SIZE”:512,“KEEPALIVE”:15}}
{“StatusTIM”:{“UTC”:“Mon Dec 18 16:06:23 2017”,“Local”:“Mon Dec 18 17:06:23 2017”,“StartDST”:“Sun Mar 26 02:00:00 2017”,“EndDST”:“Sun Oct 29 03:00:00 2017”,“Timezone”:1}}
{“StatusSNS”:{“Time”:“2017-12-18T17:06:23”,“DHT11”:{“Temperature”:71.6,“Humidity”:36.0},“TempUnit”:“F”}}
{“StatusSTS”:{“Time”:“2017-12-18T17:06:23”,“Uptime”:18,“Vcc”:3.210,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“SSID1”,“RSSI”:64,“APMac”:“XX:XX:XX:XX:XX:XX”}}}

I don’t need all this to be exported but i would like to potentially export any of the fields. Also I want to ignore the time and let influx use its own timestamp.
How should I configure telegraf.conf?

You need an input plugin that supports data_format = “json”

There’s a few, such as:

Example that explains data_format for exec:

In your case I guess you need to use mqtt_consumer and set data_format to json.

Thank you for pointing me in the right direction. I looked at those pages again (I did try to figure this out before I asked for help). I am still having some trouble.
How can I ignore the metrics I dont care about or need more than once.
How can I get telegraf to parse strings deep into the json code. for example in the following json I can not get the strings (i.e. SSId) even using tag_keys deignation because it is too deep (I think).

{
"Time":"2017-12-20T01:02:10",
"Uptime":1,
"Vcc":3.211,
"POWER":"OFF",
"Wifi":
    {
    "AP":1,
    "SSId":"SSID1",
    "RSSI":74,
    "APMac":"XX:XX:XX:XX:XX:XX"
    }
}

here is the mqtt part of my config:

# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
  name_override = "SensorTest1"
  servers = ["tcp://localhost:1883"]
  qos = 0
  connection_timeout = 30
  topics = [
    "+/Eco_dht11/#",
    "+/sonoff/#",
  ]
  persistent_session = true
  client_id = "AbrahamL"

  data_format = "json"
  tag_keys = [
  "Wifi_SSId"
    ]

From what I could find, it looks like it’s not supported by the current json parser. It drops strings unless they are in the tag_keys and in the root level.

There’s an issue about it but it’s still open. Your options at this point are to wait or program a plugin yourself.

Related issue: