Split collected data and insert it as tags values

Hi,

I’m using telegraf with inputs.snmp to collect interfaces descriptions from cisco devices.
So far it is working ok but telegraf inyects all the decription into one tag type column and I would like to split the text by whitespaces and insert it into different tag type columns.
I know this descriptions will always have the exact same format.

Can I do this with Telegraf? Or do i have to work with Kapacitor directly?
Or this can’t be done either way?

Telegraf v1.5.2
Kapacitor v1.4.0

[[inputs.snmp]]
agents = [ “HOST” ]
timeout = “10s”
retries = 3
version = 2
community = “public”
[[inputs.snmp.table]]
name = “test_table”
index_as_tag = true
[[inputs.snmp.table.field]]
name = “pppSessTot”
oid = “1.3.6.1.4.1.9.9.786.1.2.1.1.5.2”
oid_index_suffix = “.1”
[[inputs.snmp.table.field]]
name = “description”
oid = “1.3.6.1.2.1.31.1.1.1.18”
is_tag = true
[[inputs.snmp.table.field]]
name = “ifaceName”
oid = “1.3.6.1.2.1.31.1.1.1.1”
[[inputs.snmp.table.field]]
name = “inbps”
oid = “1.3.6.1.2.1.31.1.1.1.6”
[[inputs.snmp.table.field]]
name = “outbps”
oid = “1.3.6.1.2.1.31.1.1.1.10”

Example output:

collector,index=435,description=Cisco Sub Interface Description ,agent_host=HOST ,host=grafana-srv pppSessTot=111,ifaceName=“InterfaceName”, inbps=4967476543061i,outbps=59008607926711i 1520963841000000000

I would like to have the tag value “CIsco Subs Interface Description” split into 4 different tag type columns

Any kind of help is more than welcome.

Regards
Marcelo

Telegraf can’t do this out of the box, you would need a custom processor plugin written in Go.

Daniel,

Thank you for your answer.

I will assume that Kapacitor does not have this functionality either, is that correct?
I’ve seen some doc about strTrim function or other functions for strings and regex but it does not seem to match with what I’m expecting to have as result.

Do you have any recomended documentation about how to create custom plugins on Telegraf?

Thanks in advance

Regards
Marcelo

Here is the documentation for writing a processor plugin for Telegraf: telegraf/CONTRIBUTING.md at master · influxdata/telegraf · GitHub. I don’t think this a plugin that we would merge into the official Telegraf repo, it seems like a very specialized use.

@michael Do you know if Kapacitor can handle this use case?

@daniel thank you so much for your help.
@michael any help with this is appreciated.

Regards
Marcelo

I don’t think it’ll be possible to do in kapacitor without a UDF. :confused:

Ok then, I’ll investigate about UDF and custom plugins
Thank you both.

Regards
Marcelo