Telegraf:多条HTTP输入线

时间:2019-05-13 18:18:34

标签: http telegraf telegraf-inputs-plugin

我正在尝试使用两个单独的HTTP输入配置通过Telegraf从HTTP端点获取指标。这是因为每个人都需要不同的标题。当我使用以下配置时,出现以下错误

  

运行代理时出错:解析telegraf.conf时出错,toml:第333行:   表“标头”与第311行中的普通表冲突

[[inputs.http]]
  headers = {"Content-Type" = "application/json", "X-M2EE-Authentication" = "fooBar", "action" = "action1", "params" = "{}"}


  urls = [
    "http://localhost:8090"
  ]

  method = "POST"
  data_format = "json"



[[inputs.http]]
  headers = {"Content-Type" = "application/json", "X-M2EE-
Authentication" = "fooBar", "action" = "action2", "params" = "{}"}

  urls = [
    "http://localhost:8090"
  ]

  method = "POST"
  data_format = "json"

在我实施建议时,我在github here上发现了一个相关的问题

goroutine 1 [running]:
reflect.MakeSlice(0x2905820, 0x1edf720, 0x0, 0x1, 0x1edf720, 0xc0001fa870, 0x23)
        /usr/local/go/src/reflect/value.go:2192 +0x1e9
github.com/influxdata/telegraf/vendor/github.com/influxdata/toml.setArray(0x1edf720, 0xc000099b80, 0x198, 0xc0000a9b80, 0x20, 0x0)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/vendor/github.com/influxdata/toml/decode.go:347 +0x218
github.com/influxdata/telegraf/vendor/github.com/influxdata/toml.setValue(0x1edf720, 0xc000099b80, 0x198, 0x28bfb20, 0xc0000a9b80, 0x1edf720, 0xc000099b80)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/vendor/github.com/influxdata/toml/decode.go:266 +0x4b1
github.com/influxdata/telegraf/vendor/github.com/influxdata/toml.UnmarshalTable(0xc00048a3c0, 0x1f8a640, 0xc00047ad80, 0x1f8a601, 0x1f8a640)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/vendor/github.com/influxdata/toml/decode.go:127 +0x1068
github.com/influxdata/telegraf/vendor/github.com/influxdata/toml.UnmarshalTable(0xc0000de280, 0x21a38c0, 0xc0001e0300, 0xc0004b8600, 0x0)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/vendor/github.com/influxdata/toml/decode.go:161 +0xa85
github.com/influxdata/telegraf/internal/config.(*Config).addInput(0xc000404000, 0xc00014b110, 0x4, 0xc0000de280, 0x0, 0x0)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/internal/config/config.go:926 +0x181
github.com/influxdata/telegraf/internal/config.(*Config).LoadConfig(0xc000404000, 0xc0000ac0a0, 0xd, 0x42f7db0, 0x1)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/internal/config/config.go:681 +0x661
main.runAgent(0x28d0de0, 0xc0000a8940, 0x42f7db0, 0x0, 0x0, 0x42f7db0, 0x0, 0x0, 0x0, 0x0)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:122 +0x2c5
main.reloadLoop(0xc000174000, 0x42f7db0, 0x0, 0x0, 0x42f7db0, 0x0, 0x0, 0x42f7db0, 0x0, 0x0, ...)
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:102 +0x26c
main.main()
        /Users/gangadhar/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:386 +0x56d

有没有已知的方法在Telegraf中使用多个HTTP输入配置?

Telegraf 1.10.2(git:telegraf-1.10.2 6a7d0c14)

0 个答案:

没有答案