IF-MIB::ifXTable filter

Hi, for some time I’m collecting whole IF-MIB::ifXTable table, but there lots of data which I’m not using, how can I query only:
ifHCInOctets
ifHCOutOctets

current telegraf configuration:
[[inputs.snmp.field]]
name = “hostname”
oid = “SNMPv2-MIB::sysName.0”
is_tag = true
[[inputs.snmp.table]]
oid = “IF-MIB::ifXTable”
inherit_tags = [“hostname”]
index_as_tag = true
[[inputs.snmp.table.field]]
is_tag = true
oid = “IF-MIB::ifDescr”

Thanks

Hello @Paroles_Paroles,
Maybe try something like:

[[inputs.snmp]]
  ## Other SNMP input configuration settings...

  # Get the hostname for tagging purposes
  [[inputs.snmp.field]]
    name = "hostname"
    oid = "SNMPv2-MIB::sysName.0"
    is_tag = true

  # Define a table specifically for ifHCInOctets and ifHCOutOctets
  [[inputs.snmp.table]]
    oid = "IF-MIB::ifXTable"
    inherit_tags = ["hostname"]
    index_as_tag = true

    # Specify only the fields you need (ifHCInOctets and ifHCOutOctets)
    [[inputs.snmp.table.field]]
      name = "ifHCInOctets"
      oid = "IF-MIB::ifHCInOctets"
      # is_tag = false is default and can be omitted

    [[inputs.snmp.table.field]]
      name = "ifHCOutOctets"
      oid = "IF-MIB::ifHCOutOctets"
      # is_tag = false is default and can be omitted

  # Include ifDescr as a tag if needed for identification
  [[inputs.snmp.table.field]]
    name = "interface"
    oid = "IF-MIB::ifDescr"
    is_tag = true

Tried this way, but still in Influx I see all table data

time                 agent_host  host   hostname    ifAlias ifHCInBroadcastPkts ifHCInMulticastPkts ifHCInOctets ifHCInUcastPkts ifHCOutBroadcastPkts ifHCOutMulticastPkts ifHCOutOctets ifHCOutUcastPkts ifHighSpeed ifInBroadcastPkts ifInMulticastPkts ifName             ifOutBroadcastPkts ifOutMulticastPkts index interface
----                 ----------  ----   --------    ------- ------------------- ------------------- ------------ --------------- -------------------- -------------------- ------------- ---------------- ----------- ----------------- ----------------- ------             ------------------ ------------------ ----- ---------
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 ether1             0                  0                  1     ether1
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE defconf 0                   0                   1679326310   4926515         0                    0                    28955547370   25426053         0           0                 0                 bridge             0                  0                  9     bridge
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   24899235463  21231977        0                    0                    1327085756    4063729          0           0                 0                 lte1               0                  0                  8     lte1
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                50          0                 0                 wlan2              0                  0                  7     wlan2
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                50          0                 0                 wlan1              0                  0                  6     wlan1
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 ether5             0                  0                  5     ether5
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 ether4             0                  0                  4     ether4
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 ether3             0                  0                  3     ether3
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 ether2             0                  0                  2     ether2
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   1748297520   4926515         0                    0                    29363157325   26644918         0           0                 0                 5Ghz-Chateau LTE-1 0                  0                  11    5Ghz-Chateau LTE-1
2024-03-12T06:50:00Z 192.168.8.1 ubuntu Chateau LTE         0                   0                   0            0               0                    0                    0             0                0           0                 0                 2Ghz-Chateau LTE-1 0                  0                  10    2Ghz-Chateau LTE-1

This worked for me

[[inputs.snmp.field]]
name = "hostname"
oid = "SNMPv2-MIB::sysName.0"
is_tag = true
[[inputs.snmp.table]]
name = "ifXTable"
inherit_tags = ["hostname"]
index_as_tag = true
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCInOctets"
name = "ifHCInOctets"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCOutOctets"
name = "ifHCOutOctets"
[[inputs.snmp.table.field]]
name = "interface"
oid = "IF-MIB::ifDescr"
is_tag = true

Hello,

I kinda have the same problem.

Does this worked for you with this indentation?
Are you only getting ifHCIn/OutOctets and ifDescr column on your measurement? (I’m not)

Regards

With config above I’m getting only such values:

time                 agent_host  host   hostname    ifHCInOctets ifHCOutOctets index interface
----                 ----------  ----   --------    ------------ ------------- ----- ---------
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             1     ether1
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 1681638283   28969884794   9     bridge
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             10    2Ghz-Chateau LTE-1
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             2     ether2
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             6     wlan1
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             7     wlan2
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             3     ether3
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 24902843983  1330124522    8     lte1
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 1750872763   29387926847   11    5Ghz-Chateau LTE-1
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             4     ether4
2024-03-12T15:06:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             5     ether5
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             4     ether4
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             5     ether5
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             2     ether2
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 1681641499   28969910044   9     bridge
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             1     ether1
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 24902850092  1330130326    8     lte1
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             3     ether3
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             6     wlan1
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             10    2Ghz-Chateau LTE-1
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 1750876399   29387973166   11    5Ghz-Chateau LTE-1
2024-03-12T15:07:00Z 192.168.8.1 ubuntu Chateau LTE 0            0             7     wlan2