SNMP recovery problem

I am recovering data from olt zte, and I have problems because it has double or secondary indexes… I provide a zabbix template and how to recover them but in telegraf I can not do that
discovery_rules:

uuid: b612951f77ec4ceb81eb30423637ee43
name: ‘ONU discovery on pon1’
type: SNMP_AGENT
snmp_oid: ‘discovery[{#SNMPVALUE},.1.3.6.1.4.1.3902.1012.3.28.1.1.2.268501248]’
key: .1.3.6.1.4.1.3902.1012.3.28.1.1.2.1
delay: ‘1800’
lifetime: 7d
item_prototypes:

uuid: 688866c40c664dc28bd71a91e776c2b8 name: ‘{#SNMPINDEX} Onu-rx’ type: SNMP_AGENT snmp_oid: ‘.1.3.6.1.4.1.3902.1012.3.50.12.1.1.10.268501248.{#SNMPINDEX }.1’ key: ‘.1.3.6.1.4.1.3902.1012.3.50.12.1.1.10.268501248.[{#SNMPINDEX}]’ delay: ‘900’ history: 1d tags: - tag: Application value: snmp -

203 / 5,000

my oid to recover the data is 1.3.6.1.4.1.3902.1012.3.50.12.1.1.10 but I see that zabbix uses .3.6.1.4.1.3902.1012.3.50.12.1.1.10.268501248.{#SNMPINDEX}.1 with telegraf I can not recover that way

@Carlos_Segala currently there is (almost) no discovery mechanism for configuring plugins. So you need to discover the devices in some other way and generate the telegraf configuration using e.g. a small python program with a templating engine…

And also, if you define an [[inputs.snmp.table]], then all the rows of that table will be gathered by default…

My table is [[inputs.snmp.table]] name = “onu” oid = “1.3.6.1.4.1.3902.1012.3.50.12.1” index_as_tag = true but it gives me this error in telegraf [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table un: getting table columns: Was that a table? ZXXPON-PROTECTION-MIB::zxPON.3.50.12.1: exit status 1

You don’t seem to have the MIB to translate the OID or to figure out the fields on that table. You can add the fields manually (which is preferable if you don’t need all the fields of the table)

Does anyone have the GPON-PROTECTION-MIB because otherwise I can’t get the double index of my ONT something like 269550336.54.1
Thanks

You don’t need the MIB, you can also specify the fields you want manually and specify the OID numerically.

I’ll send you my config to see if you can help me. When I do it via console on the command line it works fine, but then in my telegraf file it doesn’t recover the ont_rx data, so I’ve been investigating in some scripts that I saw that add a .1 to the oid at the end of the index. In the examples I saw they treat it this way .1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.{index}.1 and from what I see in telegraf it’s taking me .1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.{index} without the .1 maybe that’s it but I’m not sure.
via console
snmpwalk -OnE -v2c -c public 192.168.0.200 1.3.6.1.4.1.3902.1012.3.50.12.1.1.14
.1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.268501248.1.1 = INTEGER: 65535
.1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.268501248.2.1 = INTEGER: 65535
.1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.268501248.3.1 = INTEGER: 15939
.1.3.6.1.4.1.3902.1012.3.50.12.1.1.14.268501248.4.1 = INTEGER: 16073
conf file
[[inputs.snmp]]
agents = [“192.168.0.200:161”]
version = 2
community = “public”
interval = “900s”
name = “olt”

[[inputs.snmp.table]]
name = “olt”
oid = “IF-MIB::ifXTable”
index_as_tag = true

[[inputs.snmp.table.field]]
name = “ifNombre”
oid = “IF-MIB::ifName”
is_tag = true

[[inputs.snmp.table.field]]
name = “ifIndex”
oid = “IF-MIB::ifIndex”
is_tag = true

[[inputs.snmp.table.field]]
name = “ont_rx”
oid = “1.3.6.1.4.1.3902.1012.3.50.12.1.1.14”

It is a separate table, so must be defined as such in telegraf as well:

[[inputs.snmp.table]]
  name = "something"
  index_as_tag = true

[[inputs.snmp.table.field]]
  name = "ont_rx"
  oid = “1.3.6.1.4.1.3902.1012.3.50.12.1.1.14”

Yes, I tried it like that once and it didn’t work for me - in fact, I just tried it again that way, but it only shows me the data from the previous fields but not that one, I don’t understand why it doesn’t show them to me -
Maybe it’s because that oid queries the onts that are connected to an olt and maybe it takes longer than the oids of the main equipment. But I added a timeout = “300s” but it didn’t work for me either.

Can you show the output of that table when running telegraf --test? and please use code blocks so everything keeps being readable…

if the current configuration and the output go there
[[inputs.snmp]]
agents = [“172.20.0.2:161”]
version = 2
community = “public”
interval = “900s”
name = “olt”

[[inputs.snmp.table]]
name = “olt”
oid = “IF-MIB::ifXTable”
index_as_tag = true

[[inputs.snmp.table.field]]
name = “ifNombre”
oid = “IF-MIB::ifName”
is_tag = true

[[inputs.snmp.table.field]]
name = “ifIndex”
oid = “IF-MIB::ifIndex”
is_tag = true

[[inputs.snmp.table]]
name = “ont”
index_as_tag = true

[[inputs.snmp.table.field]]
name = “ont_rx”
oid = “1.3.6.1.4.1.3902.1012.3.50.12.1.1.14”

:point_up: please see this and adapt your last post.

Maybe also add --debug as it seems the ont metrics aren’t collected…

root@raspberrypi:/etc/telegraf/telegraf.d# telegraf --config olt.conf --test --debug
2024-09-06T13:34:01Z I! Loading config: olt.conf
2024-09-06T13:34:01Z I! Starting Telegraf 1.28.2 brought to you by InfluxData the makers of InfluxDB
2024-09-06T13:34:01Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
2024-09-06T13:34:01Z I! Loaded inputs: snmp
2024-09-06T13:34:01Z I! Loaded aggregators:
2024-09-06T13:34:01Z I! Loaded processors:
2024-09-06T13:34:01Z I! Loaded secretstores:
2024-09-06T13:34:01Z W! Outputs are not used in testing mode!
2024-09-06T13:34:01Z I! Tags enabled: host=raspberrypi
2024-09-06T13:34:01Z D! [agent] Initializing plugins
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifXTable"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "IF-MIB::ifXTable.1"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptable" "-Ch" "-Cl" "-c" "public" "127.0.0.1" "IF-MIB::ifXTable"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifName"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifIndex"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifInMulticastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifInBroadcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifOutMulticastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifOutBroadcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCInOctets"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCInUcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCInMulticastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCInBroadcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCOutOctets"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCOutUcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCOutMulticastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHCOutBroadcastPkts"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifLinkUpDownTrapEnable"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifHighSpeed"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifPromiscuousMode"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifConnectorPresent"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifAlias"
2024-09-06T13:34:01Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" "IF-MIB::ifCounterDiscontinuityTime"
2024-09-06T13:34:01Z D! [agent] Starting service inputs
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502528,ifNombre=gpon_1/2/7,index=268502528 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501248,ifNombre=gpon_1/2/2,index=268501248 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502016,ifNombre=gpon_1/2/5,index=268502016 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435456,ifNombre=gpon_1/1/1,index=268435456 ifHCInOctets=5235612672971i,ifHCOutOctets=30217644713758i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502784,ifNombre=gpon_1/2/8,index=268502784 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435712,ifNombre=gpon_1/1/2,index=268435712 ifHCInOctets=9188924469810i,ifHCOutOctets=167790373640875i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268500992,ifNombre=gpon_1/2/1,index=268500992 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268566528,ifNombre=gei_1/3/1,index=268566528 ifHCInOctets=424946230354820i,ifHCOutOctets=26487409297363i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436224,ifNombre=gpon_1/1/4,index=268436224 ifHCInOctets=5116540962516i,ifHCOutOctets=87710738988411i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501504,ifNombre=gpon_1/2/3,index=268501504 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501760,ifNombre=gpon_1/2/4,index=268501760 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632064,ifNombre=gei_1/4/1,index=268632064 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268437248,ifNombre=gpon_1/1/8,index=268437248 ifHCInOctets=194323969179i,ifHCOutOctets=1736426606011i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632320,ifNombre=xgei_1/4/2,index=268632320 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632576,ifNombre=gei_1/4/3,index=268632576 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436992,ifNombre=gpon_1/1/7,index=268436992 ifHCInOctets=314241586108i,ifHCOutOctets=5103154163262i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268567040,ifNombre=gei_1/3/3,index=268567040 ifHCInOctets=17431607i,ifHCOutOctets=11864192i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268566784,ifNombre=xgei_1/3/2,index=268566784 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436480,ifNombre=gpon_1/1/5,index=268436480 ifHCInOctets=3857336857676i,ifHCOutOctets=60530054726863i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502272,ifNombre=gpon_1/2/6,index=268502272 ifHCInOctets=0i,ifHCOutOctets=0i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435968,ifNombre=gpon_1/1/3,index=268435968 ifHCInOctets=2488284717179i,ifHCOutOctets=43942336342070i 1725629642000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436736,ifNombre=gpon_1/1/6,index=268436736 ifHCInOctets=489332620759i,ifHCOutOctets=478901350376i 1725629642000000000
2024-09-06T13:34:06Z D! [agent] Stopping service inputs
2024-09-06T13:34:06Z D! [agent] Input channel closed
2024-09-06T13:34:06Z D! [agent] Stopped Successfully

Not sure if that will change anything, but you’re using version 1.28.2, which is from last year.

I think we will need to do a tcpdump to see what telegraf is sending and/or receiving. But please remove the olt table first, as that will give a lot of irrelevant data.

The version is not because I’m running 1.31.3 on another server and it does the same thing…
I’m suspicious of the host that may not be able to respond to requests or something like that… because at one point with the configuration that I gave you it brought me some data but only from approximately 10% of the devices

> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501504,ifNombre=gpon_1/2/3,index=268501504 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/3" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632576,ifNombre=gei_1/4/3,index=268632576 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gei_1/4/3" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268437248,ifNombre=gpon_1/1/8,index=268437248 ifHCInOctets=194323996027i,ifHCOutOctets=1736426745389i,ifName="gpon_1/1/8" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632064,ifNombre=gei_1/4/1,index=268632064 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gei_1/4/1" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501248,ifNombre=gpon_1/2/2,index=268501248 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/2" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436992,ifNombre=gpon_1/1/7,index=268436992 ifHCInOctets=314250953257i,ifHCOutOctets=5103183780407i,ifName="gpon_1/1/7" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435712,ifNombre=gpon_1/1/2,index=268435712 ifHCInOctets=9190446446950i,ifHCOutOctets=167819449519013i,ifName="gpon_1/1/2" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268566784,ifNombre=xgei_1/3/2,index=268566784 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="xgei_1/3/2" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268500992,ifNombre=gpon_1/2/1,index=268500992 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/1" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502784,ifNombre=gpon_1/2/8,index=268502784 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/8" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268567040,ifNombre=gei_1/3/3,index=268567040 ifHCInOctets=17461907i,ifHCOutOctets=11888000i,ifName="gei_1/3/3" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502272,ifNombre=gpon_1/2/6,index=268502272 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/6" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268501760,ifNombre=gpon_1/2/4,index=268501760 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/4" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435968,ifNombre=gpon_1/1/3,index=268435968 ifHCInOctets=2488530181080i,ifHCOutOctets=43947155083050i,ifName="gpon_1/1/3" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436224,ifNombre=gpon_1/1/4,index=268436224 ifHCInOctets=5117217916368i,ifHCOutOctets=87727217862680i,ifName="gpon_1/1/4" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268566528,ifNombre=gei_1/3/1,index=268566528 ifHCInOctets=425019726034228i,ifHCOutOctets=26490590644364i,ifName="gei_1/3/1" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436480,ifNombre=gpon_1/1/5,index=268436480 ifHCInOctets=3857920685311i,ifHCOutOctets=60538119258060i,ifName="gpon_1/1/5" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268436736,ifNombre=gpon_1/1/6,index=268436736 ifHCInOctets=489338948595i,ifHCOutOctets=479037912051i,ifName="gpon_1/1/6" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268632320,ifNombre=xgei_1/4/2,index=268632320 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="xgei_1/4/2" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268435456,ifNombre=gpon_1/1/1,index=268435456 ifHCInOctets=5235990280742i,ifHCOutOctets=30224853727241i,ifName="gpon_1/1/1" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502016,ifNombre=gpon_1/2/5,index=268502016 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/5" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,ifIndex=268502528,ifNombre=gpon_1/2/7,index=268502528 ifHCInOctets=0i,ifHCOutOctets=0i,ifName="gpon_1/2/7" 1725634120000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501504.7.1 ont_tx=16237i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.16.1 ont_tx=16151i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501504.4.1 ont_tx=16076i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.20.1 ont_tx=16125i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.1.1 ont_tx=65535i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.3.1 ont_tx=15977i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.14.1 ont_tx=16011i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.7.1 ont_tx=16131i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501504.5.1 ont_tx=16113i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.2.1 ont_tx=65535i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.9.1 ont_tx=16178i 1725634138000000000
> olt,agent_host=172.20.0.2,host=raspberrypi,index=268501248.13.1 ont_tx=16171i 1725634138000000000