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

Problem generating SNMP config for cIpM... metrics #1218

Open
rwgrony opened this issue Jul 18, 2024 · 5 comments
Open

Problem generating SNMP config for cIpM... metrics #1218

rwgrony opened this issue Jul 18, 2024 · 5 comments
Labels

Comments

@rwgrony
Copy link

rwgrony commented Jul 18, 2024

Host operating system: output of uname -a

Linux 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

snmp_exporter version: output of snmp_exporter -version

0.24.1

What device/snmpwalk OID are you using?

$ snmptranslate -On -IR CISCO-IETF-IPMROUTE-MIB:cIpMRouteHCOctets
.1.3.6.1.4.1.9.10.117.1.1.2.1.17
$ snmptranslate -On -IR CISCO-IETF-IPMROUTE-MIB:cIpMRouteHCPkts
.1.3.6.1.4.1.9.10.117.1.1.2.1.26
$ snmptranslate -On -IR CISCO-IETF-IPMROUTE-MIB:cIpMRouteGroup
.1.3.6.1.4.1.9.10.117.1.1.2.1.2
$ snmptranslate -On -IR CISCO-IETF-IPMROUTE-MIB:cIpMRouteEntryCount
.1.3.6.1.4.1.9.10.117.1.1.7

If this is a new device, please link to the MIB(s).

https://www.circitor.fr/Mibs/Html/C/CISCO-IETF-IPMROUTE-MIB.php

What did you do that produced an error?

I am trying to generate an SNMP config to collect the following metrics:

  • cIpMRouteEntryCount
  • cIpMRouteGroup
  • cIpMRouteHCPkts
  • cIpMRouteHCOctets

However, when running the generator, these metrics are not added to the snmp.yml file. The logs indicate issues with handling the index type for these metrics.

my generator configuration file:

auths:
  auth_v2_asr:
    community: "1234"
    version: 2

modules:
  cisco_asr_module:
    walk:
      - sysDescr
      - sysUpTime
      - ifName
      - ifAlias
      - ifHighSpeed
      - ifAdminStatus
      - ifOperStatus
      - ifInDiscards
      - ifOutDiscards
      - ifInErrors
      - ifOutErrors
      - ifHCInOctets
      - ifHCOutOctets
      - ifHCInUcastPkts
      - ifHCOutUcastPkts
      - ifHCInBroadcastPkts
      - ifHCOutBroadcastPkts
      - ifHCInMulticastPkts
      - ifHCOutMulticastPkts
      - cIpMRouteEntryCount
      - cIpMRouteGroup
      - cIpMRouteHCPkts
      - cIpMRouteHCOctets

log:

MIBDIRS='mibs' ./generator --fail-on-parse-errors generate
ts=2024-07-18T09:39:49.572Z caller=net_snmp.go:162 level=info msg="Loading MIBs" from=mibs
ts=2024-07-18T09:39:50.682Z caller=main.go:53 level=info msg="Generating config for module" module=cisco_asr_module
ts=2024-07-18T09:39:50.709Z caller=tree.go:367 level=warn msg="Can't handle index type on node, missing preceding" node=cIpMRouteHCOctets type=InetAddress missing=InetAddressType
ts=2024-07-18T09:39:50.709Z caller=tree.go:367 level=warn msg="Can't handle index type on node, missing preceding" node=cIpMRouteGroup type=InetAddress missing=InetAddressType
ts=2024-07-18T09:39:50.709Z caller=tree.go:367 level=warn msg="Can't handle index type on node, missing preceding" node=cIpMRouteHCPkts type=InetAddress missing=InetAddressType
ts=2024-07-18T09:39:50.709Z caller=main.go:68 level=info msg="Generated metrics" module=cisco_asr_module metrics=20

What did you expect to see?

The generated snmp.yml should include the specified metrics with the correct handling of InetAddressType and InetAddress indexes.

What did you see instead?

The metrics are not added to the snmp.yml file, and the logs show warnings about missing preceding indexes.

@rwgrony
Copy link
Author

rwgrony commented Jul 18, 2024

CISCO-IETF-IPMROUTE-MIB.txt
I added the MIB file because the resource is unavailable.

@SuperQ
Copy link
Member

SuperQ commented Jul 18, 2024

Try with the latest (0.26.0) generator, it has improved error handling in the MIB parser.

@rwgrony
Copy link
Author

rwgrony commented Jul 19, 2024

I updated the SNMP exporter to version 0.26.0, but now I see errors related to Go

snmp_exporter/0.26/snmp_exporter/generator$ make generate
MIBDIRS='mibs' ./generator --fail-on-parse-errors --log.level=debug generate 
ts=2024-07-19T08:59:29.556Z caller=net_snmp.go:175 level=info msg="Loading MIBs" from=mibs
ts=2024-07-19T08:59:30.361Z caller=main.go:58 level=info msg="Generating config for module" module=cisco_asr_module
panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
main.generateConfigModule.func2(0xc000ce2ee0)
        /mnt/c/Ubuntu/testing/go/snmp_exporter/0.26/snmp_exporter/generator/tree.go:390 +0x16f8
main.walkNode(0xc000ce2ee0, 0xc001211a40)
        /mnt/c/Ubuntu/testing/go/snmp_exporter/0.26/snmp_exporter/generator/tree.go:40 +0x22
main.generateConfigModule(0xc000123c20, 0xc000eeb420, 0xc001211ce8, {0x73f360, 0xc0000a4140})
        /mnt/c/Ubuntu/testing/go/snmp_exporter/0.26/snmp_exporter/generator/tree.go:339 +0xadb
main.generateConfig(0xc0000ec1c0, 0x73f360?, {0x73f360, 0xc0000a4140})
        /mnt/c/Ubuntu/testing/go/snmp_exporter/0.26/snmp_exporter/generator/main.go:67 +0x479
main.main()
        /mnt/c/Ubuntu/testing/go/snmp_exporter/0.26/snmp_exporter/generator/main.go:137 +0x3a7
make: *** [Makefile:90: generate] Error 2

I also tried generating snmp.yml without the following metrics:

  • cIpMRouteEntryCount
  • cIpMRouteGroup
  • cIpMRouteHCPkts
  • cIpMRouteHCOctets

and everything works as expected. However, I can't understand why there are issues specifically with these metrics. All the necessary MIB files are present (CISCO-IETF-IPMROUTE-MIB, SNMPv2-SMI, SNMPv2-CONF, SNMPv2-TC, SNMP-FRAMEWORK-MIB, IF-MIB, HCNUM-TC, INET-ADDRESS-MIB, IANA-RTPROTO-MIB, IPMROUTE-STD-MIB, CISCO-SMI).

@rwgrony
Copy link
Author

rwgrony commented Jul 19, 2024

I also tried enabling debug mode(--log.level=debug), but I'm not sure if it's working.

@SuperQ
Copy link
Member

SuperQ commented Jul 19, 2024

Interesting, I am able to reproduce the error. I had to find the MIB on another site as circitor.fr is down. I'll have to spend some time to figure out where the problem is. This definitely seems like a bug in how this MIB is being handled. There may be something wrong with it. But the generator should handle this gracefully.

@SuperQ SuperQ added the bug label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants