Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SNMP Plugin] Use Part of OID as Field Name #2291

Closed
TelcoJordan opened this issue Jan 18, 2017 · 5 comments
Closed

[SNMP Plugin] Use Part of OID as Field Name #2291

TelcoJordan opened this issue Jan 18, 2017 · 5 comments

Comments

@TelcoJordan
Copy link

I've run into a situation that I'm not sure can be solved using the snmp plugin. I believe I need to use a substring of a numerical OID as the name for the value obtained by querying that OID.

The component I'm querying is a Cisco 7900 series router for BGP peers prefixes.
Below is the truncated output of an snmp walk command.

$ snmpwalk -v2c -On -c myCommunity <7609 IP addr>:161 .1.3.6.1.4.1.9.9.187.1.2.4.1.1
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.232.8.5.1.128 = Counter32: 0
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.232.8.10.1.128 = Counter32: 769
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.232.8.15.1.128 = Counter32: 175
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.233.8.1.1.128 = Counter32: 284
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.233.8.5.1.128 = Counter32: 0
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.233.8.10.1.128 = Counter32: 256
.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.233.8.15.1.128 = Counter32: 191

OID .1.3.6.1.4.1.9.9.187.1.2.4.1.1 is called cbgpPeerAcceptedPrefixes in the following MIB: CISCO-BGP4-MIB and has dependencies BGP4-MIB and CISCO-SMI all located at ftp://ftp.cisco.com/pub/mibs/v2

As you can see, the IP address of each BGP peer is contained in the numerical OID. Above, Peer 10.232.8.10 has 769 accepted prefixes. Unfortunately, I can't see a way to have telegraf output this correctly.

Relevant telegraf.conf:

[[inputs.snmp]]
  agents = [ "<7609 IP addr>:161" ]
  version = 2
  timeout = "5s"
  community = "myCommunity"
  tagexclude = ["host","agent_host"]
  max_repetitions = 10
  interval = "60s"
  name = "7609_pe_summary_stats"

[[inputs.snmp.table]]
   name = "bgp_peer_prefix_counts"
   inherit_tags = [ "hostname" ]

   [[inputs.snmp.table.field]]
      oid = "1.3.6.1.4.1.9.9.187.1.2.4.1.1"

Telegraf outputs, depending on whether MIBs are loaded or not:

* Plugin: inputs.snmp, Collection 1
* Internal: 1m0s
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=175i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=256i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=769i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=284i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=0i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=0i 1484769545000000000
> bgp_peer_prefix_counts,hostname=7609_hostname 1.3.6.1.4.1.9.9.187.1.2.4.1.1=191i 1484769545000000000

* Plugin: inputs.snmp, Collection 1
* Internal: 1m0s
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=175i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=284i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=256i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=0i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=191i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=769i 1484769468000000000
> bgp_peer_prefix_counts,hostname=7609_hostname cbgpPeerAcceptedPrefixes=0i 1484769468000000000

The telegraf snmp plugin outputs only the OID prefix without the IP address information. I'm willing to accept the entire OID string if need be but I do need the prefix values to be reported uniquely.

I have looked for ways around this but cannot find the IP addresses as OID values anywhere else within the BGP route table MIBs.

System info:

Telegraf v1.1.1 (git: release-1.1.0 94de9dca1fc6efb3a4bf3ec6869c356278c6755a)
on Fedora 24

Thanks for any assistance you can provide.

@sparrc
Copy link
Contributor

sparrc commented Jan 21, 2017

cc @phemmer

@sparrc sparrc added this to the Future Milestone milestone Jan 21, 2017
@toni-moreno
Copy link
Contributor

I think you will be able to get the entire ip as a tag in snmpcollector. ( we are already getting complete domain names from some dns boxes )

Feel free to test it

https://github.com/toni-moreno/snmpcollector

https://github.com/toni-moreno/snmpcollector/wiki

@phemmer
Copy link
Contributor

phemmer commented Jan 24, 2017

Still pondering on this. It's extremely odd that this agent wouldn't provide an OID for the IP.
I think it might not be that hard to add a config flag to provide the table index as a tag.

@phemmer
Copy link
Contributor

phemmer commented Jan 28, 2017

Oh, see #1948. I think this might be a duplicate of that.

@krisvoegele
Copy link

krisvoegele commented Oct 7, 2021

@phemmer I'm running into this issue as well (polling bgp peering prefixes) but am unable to get the table index as a tag portion working. When I try the suggestions from the related issues I get "Error in plugin: initializing table bgp_peer_prefix_counts: getting table columns: Was that a table?", which I assume is due to using the wrong OID for the "inputs.snmp.table" portion. My current base config that partially works:

[[inputs.snmp.table]]
   name = "bgp_peer_accepted_prefixes"
   inherit_tags = [ "hostname" ]

   [[inputs.snmp.table.field]]
      oid = "1.3.6.1.4.1.9.9.187.1.2.4.1.1"

results in:

> bgp_peer_prefix_counts,agent_host=host1,host=host2 enterprises.9.9.187.1.2.4.1.1=10i 1633630981000000000
> bgp_peer_prefix_counts,agent_host=host1,host=host2 enterprises.9.9.187.1.2.4.1.1=7i 1633630981000000000
> bgp_peer_prefix_counts,agent_host=host1,host=host2 enterprises.9.9.187.1.2.4.1.1=22i 1633630981000000000

when I test the config via CLI, however the localhost/metrics page shows only the first peering. I'm not exactly sure which OID to use to catch the table index. Any help would be greatly appreciated.
Telegraf 1.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants