Remove "host_agent" tag


#1

Here’s a section from a config:

[[inputs.snmp]]
 agents = [ "192.168.82.208" ]
 timeout = "10s"
 retries = 3
 version = 2
 community = "public"
 name = "apc_stats"

  [[inputs.snmp.field]]
     name = "phase_voltage"
     oid = ".1.3.6.1.4.1.318.1.1.26.6.3.1.6.1"

  [[inputs.snmp.field]]
     name = "phase_current"
     oid = ".1.3.6.1.4.1.318.1.1.26.6.3.1.5.1"
     conversion = "float(1)"

  [inputs.snmp.tags]
    apc_name = "ci-f54-c09-apc1"

I’m adding a static tag to each host, so I can refer to it by name in Grafana. I would like to stop the ‘host_agent’ tag being added to the data, as it adds noise, and (I think) increases cardinality unnecessarily.
I’ve tried tagexclude = [ "host_agent" ], but that doesn’t seem to achieve anything.

TIA


#2

Using tag_exclude should work, make sure you put it before before any subtables so that it doesn’t become part of them:

[[inputs.snmp]]
 agents = [ "192.168.82.208" ]
 timeout = "10s"
 retries = 3
 version = 2
 community = "public"
 name = "apc_stats"
 tagexclude = ["agent_host"]

  [[inputs.snmp.field]]

#3

OK, thanks, will have another stab at it tomorrow.

Edit:
heh. I’ve just read your answer again, and compared it to my question. I’ve got a terrible feeling that I’ve just got the tag name wrong!


#4

@daniel Thank you . I was indeed using “host_agent” rather than “agent_host” :frowning: