Telegraf无法从Arista MIB中提取路由表信息



所以我试图从一些Aristas收集路由统计信息。

当我运行snmpwalk时,它似乎都工作了…

snmpwalk -v2c -c pub router。主机ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteTypeARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。other = Gauge32: 3ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。connected = Gauge32: 8ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。static = Gauge32: 26ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。ospf = Gauge32: 542ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。bgp = Gauge32: 1623ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv4。附件= Gauge32: 12ARISTA-FIB-STATS-MIB::aristaFIBStatsTotalRoutesForRouteType.ipv4.internal = Gauge32: 25ARISTA-FIB-STATS-MIB:: aristaFIBStatsTotalRoutesForRouteType.ipv6。other = Gauge32: 3ARISTA-FIB-STATS-MIB::aristaFIBStatsTotalRoutesForRouteType.ipv6.internal = Gauge32: 1

但是当我试图用电报拉统计数据时,我得到了不同的信息,缺少上下文…

边界网关协议,agent_host = 10.45.100.20主机= nw01.ny5,主机名= CR。NY aristaFIBStatsTotalRoutesForRouteType=2i 1654976575000000000边界网关协议,agent_host = 10.45.100.20、主机= nw01.ny5主机名= CR。NY aristaFIBStatsTotalRoutes=2260i 1654976575000000000边界网关协议,agent_host = 10.45.100.20、主机= nw01.ny5主机名= CR。NY aristaFIBStatsTotalRoutesForRouteType=8i 1654976575000000000边界网关协议,agent_host = 10.45.100.20、主机= nw01.ny5主机名= CR。NY aristaFIBStatsTotalRoutesForRouteType=63i 1654976575000000000

根据MIB文档..

https://www.arista.com/assets/data/docs/MIBS/ARISTA-FIB-STATS-MIB.txt

它正在使用IANA-RTPROTO-MIB.txt协议定义,但我不知道从哪里获得该信息,因为通过电报检索的数据没有显示我任何东西。有人知道怎么处理这个吗?

首先,您可能希望通过在inputs.snmp.table中设置index_as_tag = true来启用telegraf返回返回行的索引。

然后,在配置中添加以下处理器:

# Parse aristaFIBStatsAF and aristaFIBStatsRouteType from index for BGP table
[[processors.regex]]
namepass = ["BGP"]
order = 1
[[processors.regex.tags]]
## Tag to change
key = "index"
## Regular expression to match on a tag value
pattern = "^(\d+)\.(\d+)$"
replacement = "${1}"
## Tag to store the result
result_key = "aristaFIBStatsAF"
[[processors.regex.tags]]
## Tag to change
key = "index"
## Regular expression to match on a tag value
pattern = "^(\d+)\.(\d+)$"
replacement = "${2}"
## Tag to store the result
result_key = "aristaFIBStatsRouteType"

# Rename index to aristaFIBStatsAF for BGP table with single index row
[[processors.rename]]
namepass = ["BGP"]
order = 2
[[processors.rename.replace]]
tag = "index"
dest = "aristaFIBStatsAF"
[processors.rename.tagdrop]
aristaFIBStatsAF = ["*"]

# Translate tag values for BGP table
[[processors.enum]]
namepass = ["BGP"]
order = 3
tagexclude = ["index"]
[[processors.enum.mapping]]
## Name of the tag to map
tag = "aristaFIBStatsAF"
## Table of mappings
[processors.enum.mapping.value_mappings]
0 = "unknown"
1 = "ipv4"
2 = "ipv6"
[[processors.enum.mapping]]
## Name of the tag to map
tag = "aristaFIBStatsRouteType"
## Table of mappings
[processors.enum.mapping.value_mappings]
1   = "other"
2   = "connected"
3   = "static"
8   = "rip"
9   = "isIs"
13  = "ospf"
14  = "bgp"
200 = "ospfv3"
201 = "staticNonPersistent"
202 = "staticNexthopGroup"
203 = "attached"
204 = "vcs"
205 = "internal"

免责声明:没有在电报中测试这个,所以可能有一些错别字

最新更新