-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when table `inputs.http_response.headers' is in conflict with normal table #5635
Comments
Your configuration works for me, though there was a stray backtick that needs removed in the second plugin. Here is a complete working config you can run: [[inputs.http_response]]
address = "https://10.1.1.251/restconf/data/Cisco-IOS-XE-native:native/hostname"
method = "GET"
response_string_match = "Cisco-IOS-XE-native:hostname.: \"CSR1000v\""
insecure_skip_verify = true
[inputs.http_response.headers]
Content-Type = "application/yang-data+json"
Accept = "application/yang-data+json"
Authorization = "Basic passwordremoved"
[[inputs.http_response]]
address = "https://10.1.1.252/restconf/data/Cisco-IOS-XE-native:native/hostname"
method = "GET"
response_string_match = "Cisco-IOS-XE-native:hostname.: \"CSR1000v\""
insecure_skip_verify = true
[inputs.http_response.headers]
Content-Type = "application/yang-data+json"
Accept = "application/yang-data+json"
Authorization = "Basic passwordremoved"
[[outputs.file]]
files = ["stdout"] |
@danielnelson the stray backtick was a typo here but not in my actual config. I put the above config into a new file and it worked, however I have more than this configuration in my full telegraf.conf. I also have an inputs.http plugin enabled and when I include that above this configuration I get the error. See below for full config.
|
Interesting, I didn't know it would conflict across table types. For the record the workaround is to use only non-inline tables throughout the config. Also I spotted an issue in the naming of the tag table, corrected below: [[inputs.http]]
urls = [
"https://10.1.1.251/restconf/data/Cisco-IOS-XE-native:native/hostname",
"https://10.1.1.252/restconf/data/Cisco-IOS-XE-native:native/hostname"
]
method = "GET"
- headers = {"Content-Type" = "application/yang-data+json","Accept" = "application/yang-data+json"}
username = "username"
password = "password"
insecure_skip_verify = true
name_override = "cisco_restconf"
json_string_fields = ["Cisco-IOS-XE-native:hostname"]
data_format = "json"
+ [inputs.http.headers]
+ Content-Type = "application/yang-data+json"
+ Accept = "application/yang-data+json"
+ [inputs.http.tags]
+ tag1 = "hostname" @glinton We should add a unit test for the mixed table case to #5513, if it fails then we should probably purge this style from the sample config for now. |
I am getting the answer i want to upload it in influx now |
Going through old issues and trying to reproduce this. I went as far back as telegraf v1.14.0 and found that the config in this comment with both Closing as fixed, but if someone comes across something similar please file a new issue using the latest telegraf, and provide a full config to reproduce. Thanks! |
Relevant telegraf.conf:
System info:
telegraf v1.10.1-1
CentOS Linux release 7.6.1810 (Core)
Steps to reproduce:
Since inputs.http_response doesn't support multiple addresses in an array like inputs.http (#2294) (this really should be fixed) you have to setup multiple inputs. However when setting up multiple inputs while also using inputs.http_response.headers I get an error about a conflict from the previous input.
I read #4098 but that deals with inputs.http and inputs.http_response documentation already suggest not using non-inline table syntax. Even using inline table syntax the issue still occurs. I'm not sure if #5513 would fix this either
Expected behavior:
Telegraf should run without errors and process both inputs.http_response plugins and their headers.
When run with just 1 input plugin everything is successful
Actual behavior:
Error occurs:
The text was updated successfully, but these errors were encountered: