influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.7k stars 5.59k forks source link

Telegraf | Change the tag name for "agent_host" #6943

Closed timwellman closed 4 years ago

timwellman commented 4 years ago

No sure if I am in the correct place for this ask.

I am looking to change the tag name for "agent_host" example.

2020-01-27T13:45:52Z I! Starting Telegraf 1.10.4

SysServices,SysDescr=Cisco\ IOS\ XR\ Software\ (NCS-5500)\,\ Version\ 6.3.2\r\nCopyright\ (c)\ 2013-2017\ by\ Cisco\ Systems\,\ Inc.,_agenthost=1.1.1.7,host=4fe16b5db921,hostname=default UpTime=1817106218i 1580132754000000000

I would like to change the "agent_host" tag to "ip_addr"

danielnelson commented 4 years ago

You can use the rename processor to do this type of modification:

[[processors.rename]]
  namepass = ["SysServices"]
  [[processors.rename.replace]]
    tag = "agent_host"
    dest = "ip_addr"
timwellman commented 4 years ago

Thanks for getting back to me on this.

This did not seem to change the value though. I am still getting agent_host as the tag.

docker exec -it telegraf_Test telegraf --test --config /etc/telegraf/telegraf.d/SYS/snmp.conf_New 2020-01-30T13:13:53Z I! Starting Telegraf 1.10.4

SysServices,agent_host=1.1.1.7,device_descr=Juniper\ Networks\,\ Inc.\ qfx5100-48s-6q\ Ethernet\ Switch\,\ kernel\ JUNOS\ 14.1X53-D40.8\,\ Build\ date:\ 2016-11-09\ 02:23:05\ UTC\ Copyright\ (c)\ 1996-2016\ Juniper\ Networks\,\ Inc.,device_nm=CLGRABGUWZ01,host=abenpstream02_SYS_Test_RO_01 uptime=3383656591i 1580390033000000000

[[inputs.snmp]]

agents = [ "1.1.1.7" ] version = 2 community = "TEST_RO" interval = "300s" timeout = "3s" retries = 1 name = "SysServices"

[[inputs.snmp.field]] name = "device_nm" oid = "RFC1213-MIB::sysName.0" is_tag = true

[[inputs.snmp.field]] name = "uptime" oid = "DISMAN-EVENT-MIB::sysUpTimeInstance"

[[inputs.snmp.field]] name = "device_descr" oid = "SNMPv2-MIB::sysDescr.0" is_tag = true

[[processors.rename]] namepass = ["SysServices"] [[processors.rename.replace]] tag = "agent_host" dest = "ip_addr"


Tim Wellman Technology Splst, Service Reliability Center & Augmented Intelligence Mobile: 613.899.3595 Telus.comhttp://www.telus.com/ Facebookhttps://www.facebook.com/telus/ Twitterhttps://twitter.com/telus Instagramhttps://www.instagram.com/telus YouTubehttps://www.youtube.com/user/telus Linkedinhttps://ca.linkedin.com/company/telus TELUS The Future is Friendly®

From: Daniel Nelson [mailto:notifications@github.com] Sent: January 29, 2020 11:55 PM To: influxdata/telegraf telegraf@noreply.github.com Cc: Tim Wellman Tim.Wellman@TELUS.COM; Author author@noreply.github.com Subject: Re: [influxdata/telegraf] Telegraf | Change the tag name for "agent_host" (#6943)

You can use the rename processor to do this type of modification:

[[processors.rename]]

namepass = ["SysServices"]

[[processors.rename.replace]]

tag = "agent_host"

dest = "ip_addr"

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/influxdata/telegraf/issues/6943?email_source=notifications&email_token=AMQSFABAJ7X7TQ5ROIDFLQDRAJMQRA5CNFSM4KMDHZT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKJVYWQ#issuecomment-580082778, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMQSFADQVA2BKT2Y5B62A6TRAJMQRANCNFSM4KMDHZTQ.

danielnelson commented 4 years ago

When you run with --test the processors aren't ran, only the inputs. The best way to debug processors is by temporarily replacing the real output with a file output writing to stdout, and running without --test for a few intervals.