Hello,
I have the following telegraf config:
[[inputs.snmp]]
agents = ['1.1.1.1', '2.2.2.2']
version = 2
community = "xxxxx"
interval = "10m"
[[inputs.snmp.field]]
oid = "1.3.6.1.2.1.1.3.0"
name = "sysUptime"
[[inputs.snmp.field]]
oid = "1.3.6.1.2.1.1.6.0"
name = "location"
is_tag = true
I send this to prometheus, this results in the metric:
snmp_sysUptime{agent_host=“1.1.1.1”,host=“dashboard”,location=“1234_k1”} 1.5601714e+07
snmp_sysUptime{agent_host=“2.2.2.2”,host=“dashboard”,location=“4321_k1”} 1.5601714e+07
I also have other metrics in my telegraf config, like:
[[inputs.gnmi.subscription]]
name = "if_counters"
path = "/interfaces/interface/state/counters"
subscription_mode = "sample"
sample_interval = "10s"
and:
[[inputs.ping]]
urls = ['1.1.1.1', '2.2.2.2']
ping_interval = 10.0
This results in metrics like:
if_counters_in_broadcast_pkts{host=“dashboard”,name=“interfaceName”,path=“/interfaces”,source=“1.1.1.1”} 0
if_counters_in_broadcast_pkts{host=“dashboard”,name=“interfaceName”,path=“/interfaces”,source=“2.2.2.2”} 0
and:
ping_result_code{host=“dashboard”,url=“1.1.1.1”} 0
ping_result_code{host=“dashboard”,url=“2.2.2.2”} 0
I want to add the location, from the inputs.snmp.field, as a tag to all my other metrics based on the ip address. It should look like:
if_counters_in_broadcast_pkts{host=“dashboard”,name=“interfaceName”,path=“/interfaces”,source=“1.1.1.1”, location=“1234_k1”} 0
if_counters_in_broadcast_pkts{host=“dashboard”,name=“interfaceName”,path=“/interfaces”,source=“2.2.2.2”, location=“4321_k1”} 0
ping_result_code{host=“dashboard”,url=“1.1.1.1”, location=“1234_k1”} 0
ping_result_code{host=“dashboard”,url=“2.2.2.2”, location=“4321_k1”} 0
Is this possible?