Inputs.http Bucket

Does inputs.http support tagging a bucket under it? Each time I try to add one I keep receiving the below error. In our setup we only have an input.http and agent in this file, so far neither allow me to specify a bucket under them like we did under our other config files that use inputs.snmp.

error loading config file /etc/telegraf/telegraf.conf: plugin inputs.http: line 32: configuration specified the fields [“bucket”], but they were not used. This is either a typo or this config option does not exist in this version.

I’m not sure what you mean by bucket? The http plugin has no concept of a bucket. Are you trying to add a random tag called bucket with a specific value?

so far neither allow me to specify a bucket under them like we did under our other config files that use inputs.snmp.

Can you show what you are doing with snmp?

We are trying to tag a bucket so that it goes into that in our TSDB, below is how we are doing that with snmp. Along with that I am just trying to add tags (like we did in the inputs.snmp) so that I can tag things like source device/hostname. i.e. I tried to use agent_host_tag = “source” in the inputs.http file just like our snmp config below and it gave the same error as above (error loading config file /etc/telegraf/telegraf.conf: plugin inputs.http: line 30: configuration specified the fields [“agent_host_tag”], but they were not used. This is either a typo or this config option does not exist in this version.).

[[inputs.snmp]]

agents = [
“udp://************:161”
]
interval = “30s”
timeout = “5s”
version = 3
agent_host_tag = “source”
retries = 0
sec_name = **********
auth_protocol = **********
auth_password = ***********
sec_level = “authPriv”
priv_protocol = *********
priv_password = ************

name = "snmp_basic_info"

[inputs.snmp.tags]
 bucket_name = "********"
 name = "snmp_basic_info"
[[inputs.snmp.field]]
  name = "hostname"
  oid = "1.3.6.1.2.1.1.5.0"
  is_tag = true
[[inputs.snmp.field]]
    name = "uptime"
    oid = "1.3.6.1.2.1.1.3.0"
[[inputs.snmp.field]]
    name = "sysDescr"
    oid = "1.3.6.1.2.1.1.1.0"
    is_tag = true

The inputs.http config that I am working on:

[[inputs.http]]
agent_host_tag = “source”
insecure_skip_verify = true
cookie_auth_url = “"
cookie_auth_method = “POST”
cookie_auth_username = "
"
cookie_auth_password = "
"
cookie_auth_headers = { Content-Type = “application/json” }
cookie_auth_body = '{“user”: "
", “password”: "**”, “token”: “”}’

interval = “60s”
method = “GET”
urls = [“*****"]
timeout = “5s”
data_format = “json”
name_override = "

Ah this is just adding tags to every metric generated. You can do this in any plugin using the same format:

[[inputs.http]]
  [inputs.http.tags]
    bucket_name = "********"

or to avoid TOML tables do

[[inputs.http]]
  tags = {bucket_name = "****"}

You can see examples from the CPU plugin in the configuration docs

Maybe I am just glossing over something simple, but both of these options below result in no data (printing to local file).

Option 1:

[[inputs.http]]
insecure_skip_verify = true
cookie_auth_url = “"
cookie_auth_method = “POST”
cookie_auth_username = "
"
cookie_auth_password = "
"
cookie_auth_headers = { Content-Type = “application/json” }
cookie_auth_body = '{“user”: "", “password”: "
**”, “token”: “”}’

interval = “15s”
method = “GET”
urls = [“**********”]
timeout = “5s”
data_format = “json”
name_override = “********”

[[inputs.http.tags]]
bucket = “*******”

Option 2:

[[inputs.http]]
insecure_skip_verify = true
cookie_auth_url = “"
cookie_auth_method = “POST”
cookie_auth_username = "
"
cookie_auth_password = "
"
cookie_auth_headers = { Content-Type = “application/json” }
cookie_auth_body = '{“user”: "", “password”: "
**”, “token”: “”}’

[[inputs.http.tags]]
bucket = “"
interval = “15s”
method = “GET”
urls = ["
***”]
timeout = “5s”
data_format = “json”
name_override = “********”

Option 1 is wrong because you used the wrong number of brackets. Look at my post again i.e. [inputs.http.tags]. It is a TOML table.

Option 2 won’t work because telegraf has no idea when that table ends. It now assumes that interval and all those other settings are a tag you want to add. This is why I also suggested the second method to avoid TOML tables.

You were right, I had added an extra set of brackets that were throwing things off. Corrected that and it is passing the bucket name now.

1 Like