influxdata/helm-charts

Wrong conversion of .Values.config with topic_parsing

0Bu opened this issue · 2 comments

0Bu commented

https://github.com/influxdata/helm-charts/tree/master/charts/telegraf

The config definition in the .Values.config creates wrong sorted config with tplVersion=2 (as well with version 1)

.Values.config

...
    inputs:
      - mqtt_consumer:
          name_override: "shelly_3em"
          servers: ["tcp://A.B.C.D:1883"]
          topics: ["shellies/shellyem3-ABCD/+/+/+"]
          topic_tag: ""
          data_format: "value"
          data_type: "float"
          topic_parsing: 
          - topic: "shellies/+/+/+/+"
            measurement: "_/_/_/_/measurement"
            tag: "_/device/_/phase/field"
...

Result

    [[inputs.mqtt_consumer]]     
      data_format = "value"      
      data_type = "float"        
      name_override = "shelly_3em"
      servers = [                 
        "tcp://A.B.C.D:1883" 
      ]                           
      [[inputs.mqtt_consumer.topic_parsing]]
         measurement = "_/_/_/_/measurement"
         tag = "_/device/_/phase/field"     
         topic = "shellies/+/+/+/+"         
      topic_tag = ""                        
      topics = [                            
        "shellies/shellyem3-ABCD/+/+/+"
      ] 

Error
[telegraf] Error running agent: Error loading config file /etc/telegraf/telegraf.conf: plugin inputs.mqtt_consumer: line 32: configuration specified the fields ["tag"], but they weren't used


Should be

    [[inputs.mqtt_consumer]]                    
      data_format = "value"                     
      data_type = "float"                       
      name_override = "shelly_3em"              
      servers = [                               
        "tcp://A.B.C.D:1883"               
      ]                                         
      topics = [                                
        "shellies/shellyem3-ABCD/+/+/+"
      ]                                           
      topic_tag = ""                              
      [[inputs.mqtt_consumer.topic_parsing]]      
        topic = "shellies/+/+/+/+"                
        measurement = "_/_/_/_/measurement"       
        tags = "_/device/_/phase/field"     

It looks like a typo in .Values.config to me, there really is tag instead of tags:

            tag: "_/device/_/phase/field"
0Bu commented

@alespour oh crap, thx!