influxdata / influxdata/telegraf

Telegraf inputs.snmp plugin - add support for converting decimal index to ASCII text

Open
#11,733 4 comments 2 reactions 0 assignees View on GitHub
area/snmp feature request plugin/input
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

Hi team,
I am looking for a way for Telegraf SNMP Input plugin to convert decimal index into ASCII text. Searching previous issues on this topic has not produced anything useful.
Example:
When I poll the device in question (Cisco router) via NetSNMP from CLI I get the following result:
`snmpget -v2c -c somecommunity 123.123.123.123 MPLS-VPN-MIB::mplsVpnVrfRouteDistinguisher`

output:
`MPLS-VPN-MIB::mplsVpnVrfRouteDistinguisher."internet" = STRING: "65500:40104"`
Where "internet" is index, represented as ASCII string of the name of Vrf and result is a route descriptor.

When I use Telegraf for the same query:

```
[[inputs.snmp.table]]
name = "VrfRDTable"
# oid = "MPLS-VPN-MIB::mplsVpnVrfTable"
inherit_tags = ["device"]
index_as_tag = true

[[inputs.snmp.table.field]]
name = "VrfRouteDistinguisher"
oid = "MPLS-VPN-MIB::mplsVpnVrfRouteDistinguisher"
is_tag = true

[[inputs.snmp.table.field]]
name = "VrfDescription"
oid = "MPLS-VPN-MIB::mplsVpnVrfDescription"
```

I get the following:

`VrfRDTable,index=8.105.110.116.101.114.110.101.116.1.3,VpnVrfRouteTarget="65500:40104"`

Here, we see that index is shown as decimal representation of VRF name (8.105.110.116.101.114.110.101.116.1.3).

Cisco documentation on this states as follows:

:The mplsVpnVrfName is actually an octet string that represents the string length and the ASCII codes for each character.
For example, "VPN1" is represented as "4.86.80.78.49".

This practice is widely used for SNMP OID's throught networking industry, so I think it would be beneficial to add some way of translating decimal to ASCII string.

Contributor guide

Open the contributing guide

Research direction

Start at the Telegraf inputs.snmp plugin's table index handling, using the issue's mplsVpnVrfRouteDistinguisher configuration and decimal index example as the reproduction. The work is done when an encoded SNMP index such as 8.105.110.116.101.114.110.101.116.1.3 can be represented as ASCII text while existing index behavior remains usable; add or update focused plugin tests if the surrounding code provides them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.