OID working in snmpwalk but not in generator.

108 views
Skip to first unread message

sabarish narayanan

unread,
Oct 5, 2020, 3:38:30 AM10/5/20
to Prometheus Users
Hi everyone. I'm getting the following error when I try to generate the snmp.yml file :-

msg="Error generating config netsnmp" err="cannot find oid 'enterprises.9.9.13.1.3.1.2' to walk"

msg="Error generating config netsnmp" err="cannot find oid '.1.3.6.1.4.1.9.9.13.1.3.1.2' to walk"

Here are the snmpwalk outputs :-

# snmpwalk -v3 -l authPriv -u ***** -a SHA -A ****** -x AES -X ****** XX.XX.XX.XX enterprises.9.9.13.1.3.1.2
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1011 = STRING: "Switch 1 - Inlet Temp Sensor, GREEN "
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1012 = STRING: "Switch 1 - Outlet Temp Sensor, GREEN "
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1013 = STRING: "Switch 1 - HotSpot Temp Sensor, GREEN "


# snmpwalk -v3 -l authPriv -u ***** -a SHA -A ****** -x AES -X ****** XX.XX.XX.XX .1.3.6.1.4.1.9.9.13.1.3.1.2
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1011 = STRING: "Switch 1 - Inlet Temp Sensor, GREEN "
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1012 = STRING: "Switch 1 - Outlet Temp Sensor, GREEN "
SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1013 = STRING: "Switch 1 - HotSpot Temp Sensor, GREEN "



Here's my generator.yml file :-

modules:
  XPPC
-MIB:
    walk
:
     
- upsThreePhaseBatteryTimeRemain
     
- upsThreePhaseBatteryTemperature
     
- upsThreePhaseOutputFrequency
     
- upsThreePhaseOutputVoltageR
     
- upsThreePhaseOutputVoltageS
     
- upsThreePhaseOutputVoltageT
     
- upsThreePhaseOutputLoadPercentageR
     
- upsThreePhaseOutputLoadPercentageS
     
- upsThreePhaseOutputLoadPercentageT
     
- upsConfigOutputVA
    version
: 3
    max_repetitions
: 25
    retries
: 3
    timeout
: 10s
    auth
:
      username
: ********
      security_level
: authNoPriv
      password
: ********
      auth_protocol
: MD5
    lookups
:
     
- source_indexes: [upsThreePhaseBatteryTimeRemain]
        lookup
: TimeRemain
     
- source_indexes: [upsThreePhaseBatteryTemperature]
        lookup
: BatteryTemperature
     
- source_indexes: [upsThreePhaseOutputFrequency]
        lookup
: OutputFrequency
     
- source_indexes: [upsThreePhaseOutputVoltageR]
        lookup
: OutputVoltageR
     
- source_indexes: [upsThreePhaseOutputVoltageS]
        lookup
: OutputVoltageS
     
- source_indexes: [upsThreePhaseOutputVoltageT]
        lookup
: OutputVoltageT
     
- source_indexes: [upsThreePhaseOutputLoadPercentageR]
        lookup
: OutputLoadPercentageR
     
- source_indexes: [upsThreePhaseOutputLoadPercentageS]
        lookup
: OutputLoadPercentageS
     
- source_indexes: [upsThreePhaseOutputLoadPercentageT]
        lookup
: OutputLoadPercentageT
     
- source_indexes: [upsConfigOutputVA]
        lookup
: ApparentPowerVA
   
  cisco_switch_snmp
:
    walk
:
     
- sysName
     
- sysLocation
     
- sysUpTimeInstance
     
# - .1.3.6.1.4.1.9.9.402.1.3.1.2.1
     
# - .1.3.6.1.4.1.9.9.500.1.2.1.1.8.1001
     
- enterprises.9.9.13.1.3.1.2
     
# - .1.3.6.1.4.1.9.9.13.1.3.1.2
     
# - .1.3.6.1.4.1.9.9.13.1.3.1.3
     
# - .1.3.6.1.4.1.9.9.13.1.3.1.4
     
# - .1.3.6.1.4.1.9.9.13.1.3.1.5
     
# - .1.3.6.1.4.1.9.9.13.1.3.1.6
     
# - .1.3.6.1.4.1.9.9.13.1.5.1.2
     
# - .1.3.6.1.4.1.9.9.13.1.5.1.3
     
# - .1.3.6.1.4.1.9.9.13.1.5.1.4
     
# - .1.3.6.1.4.1.9.9.109.1.1.1.1.6
     
# - .1.3.6.1.4.1.9.9.109.1.1.1.1.7
     
# - .1.3.6.1.4.1.9.9.109.1.1.1.1.8
     
- ifHCInOctets
     
- ifHCOutOctets
     
- ifDescr
     
- ifAlias
     
- ifHighSpeed
     
- ifOperStatus
     
- ifLastChange
     
- ifInErrors
     
- ifOutErrors

    version
: 3
    max_repetitions
: 25
    timeout
: 180s
    auth
:
      username
: ********  # Required, no default. -u option to NetSNMP.
      security_level
: authPriv  # Defaults to noAuthNoPriv. -l option to NetSNMP.
                                   
# Can be noAuthNoPriv, authNoPriv or authPriv.
      password
: ******** #  # Has no default. Also known as authKey, -A option to NetSNMP.
                     
# Required if security_level is authNoPriv or authPriv.
      auth_protocol
: SHA  # MD5 or SHA, defaults to MD5. -a option to NetSNMP.
                         
# Used if security_level is authNoPriv or authPriv.
      priv_protocol
: AES  # DES or AES, defaults to DES. -x option to NetSNMP.
                         
# Used if security_level is authPriv.
      priv_password
: ******** # Has no default. Also known as privKey, -X option to NetSNMP.
                               
# Required if security_level is authPriv.

    lookups
:
     
- source_indexes: [sysName]
        lookup
: sysName
     
- source_indexes: [sysLocation]
        lookup
: sysLocation
     
- source_indexes: [sysUpTimeInstance]
        lookup
: uptime    

I tried with both enterprises.9.9.13.1.3.1.2 as well as .1.3.6.1.4.1.9.9.13.1.3.1.2 format. What changes do I need to make to generate the proper snmp.yml file? Any help is appriciated.
Thanks in advance.

Brian Candler

unread,
Oct 5, 2020, 4:30:36 AM10/5/20
to Prometheus Users
Do you have the MIB file for ciscoEnvMonMIB (1.3.6.1.4.1.9.9.13) ?  Is it in the right place, or pointed to by MIBDIRS environment variable? See:

In this case, the ones you need are:
auto/mibs/v2/CISCO-SMI.my    # gives you enterprises.9 (cisco) and enterprises.9.9 (ciscoMgmt)
auto/mibs/v2/CISCO-ENVMON-MIB.my

Using "parse_errors" will help you find missing MIB dependencies, e.g.

MIBDIRS=+auto/mibs/v2 ./generator parse_errors

Adjust until you have no MIB parsing errors.

Then in your YML file, change
- enterprises.9.9.13.1.3.1.2
to
- ciscoEnvMonTemperatureStatusDescr
and run again.

(Note: given the other commented out OIDs you have, it's probably better just to walk the whole table, ciscoEnvMonTemperatureStatusTable)

It works for me:

$ MIBDIRS=+auto/mibs/v2 ../generator generate
level=info ts=2020-10-05T08:22:41.830Z caller=net_snmp.go:142 msg="Loading MIBs" from=$HOME/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:auto/mibs/v2
level=info ts=2020-10-05T08:22:42.096Z caller=main.go:52 msg="Generating config for module" module=cisco_switch_snmp
level=info ts=2020-10-05T08:22:42.119Z caller=main.go:67 msg="Generated metrics" module=cisco_switch_snmp metrics=12
level=info ts=2020-10-05T08:22:42.120Z caller=main.go:92 msg="Config written" file=/home/ubuntu/snmp_exporter/generator/tst/snmp.yml

Aside: you may find the various public OID-searching websites helpful, e.g.

Reply all
Reply to author
Forward
0 new messages