snmp_exporter not able to generate the snmp.yml

322 views
Skip to first unread message

vishnu...@gmail.com

unread,
Aug 9, 2023, 11:03:49 PM8/9/23
to Prometheus Users
I am trying to generate the snmp.yml file for my Juniper device on a Rocky Linux 9 system. This is the first time I am doing it on the Rocky Linux system. I copied the mibs files from the Librenms git repo to the snmp_exporter/generator/mibs/ directory. When I run make generate, it throughs me the below error. 

 make generate
MIBDIRS='mibs' ./generator --fail-on-parse-errors generate
ts=2023-08-10T02:51:04.705Z caller=net_snmp.go:162 level=info msg="Loading MIBs" from=mibs
ts=2023-08-10T02:51:05.506Z caller=main.go:53 level=info msg="Generating config for module" module=juniper_srx_optics
ts=2023-08-10T02:51:05.599Z caller=main.go:68 level=info msg="Generated metrics" module=juniper_srx_optics metrics=0
ts=2023-08-10T02:51:05.599Z caller=main.go:53 level=info msg="Generating config for module" module=if_mib
ts=2023-08-10T02:51:05.705Z caller=main.go:68 level=info msg="Generated metrics" module=if_mib metrics=40
ts=2023-08-10T02:51:05.705Z caller=main.go:53 level=info msg="Generating config for module" module=juniper_srx
ts=2023-08-10T02:51:05.768Z caller=main.go:132 level=error msg="Error generating config netsnmp" err="cannot find oid 'jnxOperatingState' to walk"
make: *** [Makefile:70: generate] Error 1


I have the juniper mibs copied to the mibs folder.

# ls mibs/ | grep junos
junos
junose

also when i do ./generator generate it is looking at the /usr/share/snmp/mibs/ folder insted of the snmp_exporter/generator/mibs/ folder is there any option to include the snmp_exporter/generator/mibs/ in the lookup. 

i copied the junos mibs to /usr/share/snmp/mibs/ folder and tried running the ./generator generate command and it was giving same error. 

Some more debug

MIBDIRS=/usr/share/snmp/mibs/junos/ MIBS=: snmptranslate -On JUNIPER-MIB::jnxOperatingTable
MIB search path: /usr/share/snmp/mibs/junos/
Cannot find module (SNMPv2-TC): At line 18 in /usr/share/snmp/mibs/junos//JUNIPER-MIB
Cannot find module (SNMPv2-SMI): At line 15 in /usr/share/snmp/mibs/junos//JUNIPER-SMI
Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/junos//JUNIPER-SMI)
Unlinked OID in JUNIPER-SMI: juniperMIB ::= { enterprises 2636 }
Undefined identifier: enterprises near line 17 of /usr/share/snmp/mibs/junos//JUNIPER-SMI
Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'TimeStamp' in module #-1 (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'TimeInterval' in module #-1 (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'DateAndTime' in module #-1 (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'jnxMibs' in module JUNIPER-SMI (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'jnxChassisTraps' in module JUNIPER-SMI (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Did not find 'jnxChassisOKTraps' in module JUNIPER-SMI (/usr/share/snmp/mibs/junos//JUNIPER-MIB)
Unlinked OID in JUNIPER-MIB: jnxFruOK ::= { jnxChassisOKTraps 4 }
Undefined identifier: jnxChassisOKTraps near line 1940 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxTemperatureOK ::= { jnxChassisOKTraps 3 }
Undefined identifier: jnxChassisOKTraps near line 1924 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFanOK ::= { jnxChassisOKTraps 2 }
Undefined identifier: jnxChassisOKTraps near line 1909 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxPowerSupplyOK ::= { jnxChassisOKTraps 1 }
Undefined identifier: jnxChassisOKTraps near line 1893 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxBootFromBackup ::= { jnxChassisTraps 16 }
Undefined identifier: jnxChassisTraps near line 1874 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxHardDiskMissing ::= { jnxChassisTraps 15 }
Undefined identifier: jnxChassisTraps near line 1858 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxHardDiskFailed ::= { jnxChassisTraps 14 }
Undefined identifier: jnxChassisTraps near line 1841 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFEBSwitchover ::= { jnxChassisTraps 13 }
Undefined identifier: jnxChassisTraps near line 1824 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruCheck ::= { jnxChassisTraps 12 }
Undefined identifier: jnxChassisTraps near line 1807 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruOnline ::= { jnxChassisTraps 11 }
Undefined identifier: jnxChassisTraps near line 1791 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruOffline ::= { jnxChassisTraps 10 }
Undefined identifier: jnxChassisTraps near line 1772 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruFailed ::= { jnxChassisTraps 9 }
Undefined identifier: jnxChassisTraps near line 1756 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruPowerOn ::= { jnxChassisTraps 8 }
Undefined identifier: jnxChassisTraps near line 1737 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruPowerOff ::= { jnxChassisTraps 7 }
Undefined identifier: jnxChassisTraps near line 1718 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruInsertion ::= { jnxChassisTraps 6 }
Undefined identifier: jnxChassisTraps near line 1702 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruRemoval ::= { jnxChassisTraps 5 }
Undefined identifier: jnxChassisTraps near line 1686 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxRedundancySwitchover ::= { jnxChassisTraps 4 }
Undefined identifier: jnxChassisTraps near line 1664 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxOverTemperature ::= { jnxChassisTraps 3 }
Undefined identifier: jnxChassisTraps near line 1648 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFanFailure ::= { jnxChassisTraps 2 }
Undefined identifier: jnxChassisTraps near line 1632 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxPowerSupplyFailure ::= { jnxChassisTraps 1 }
Undefined identifier: jnxChassisTraps near line 1616 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxBoxAnatomy ::= { jnxMibs 1 }
Undefined identifier: jnxMibs near line 22 of /usr/share/snmp/mibs/junos//JUNIPER-MIB
JUNIPER-MIB::jnxOperatingTable: Unknown Object Identifier



[root@containerlab junos]# MIBDIRS=/opt/snmp_exporter/generator/mibs/junos MIBS=: snmptranslate -On JUNIPER-MIB::jnxOperatingTable
MIB search path: /opt/snmp_exporter/generator/mibs/junos
Cannot find module (SNMPv2-TC): At line 18 in /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Cannot find module (SNMPv2-SMI): At line 15 in /opt/snmp_exporter/generator/mibs/junos/JUNIPER-SMI
Did not find 'enterprises' in module #-1 (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-SMI)
Unlinked OID in JUNIPER-SMI: juniperMIB ::= { enterprises 2636 }
Undefined identifier: enterprises near line 17 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-SMI
Did not find 'DisplayString' in module #-1 (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'TimeStamp' in module #-1 (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'TimeInterval' in module #-1 (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'DateAndTime' in module #-1 (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'jnxMibs' in module JUNIPER-SMI (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'jnxChassisTraps' in module JUNIPER-SMI (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Did not find 'jnxChassisOKTraps' in module JUNIPER-SMI (/opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB)
Unlinked OID in JUNIPER-MIB: jnxFruOK ::= { jnxChassisOKTraps 4 }
Undefined identifier: jnxChassisOKTraps near line 1940 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxTemperatureOK ::= { jnxChassisOKTraps 3 }
Undefined identifier: jnxChassisOKTraps near line 1924 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFanOK ::= { jnxChassisOKTraps 2 }
Undefined identifier: jnxChassisOKTraps near line 1909 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxPowerSupplyOK ::= { jnxChassisOKTraps 1 }
Undefined identifier: jnxChassisOKTraps near line 1893 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxBootFromBackup ::= { jnxChassisTraps 16 }
Undefined identifier: jnxChassisTraps near line 1874 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxHardDiskMissing ::= { jnxChassisTraps 15 }
Undefined identifier: jnxChassisTraps near line 1858 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxHardDiskFailed ::= { jnxChassisTraps 14 }
Undefined identifier: jnxChassisTraps near line 1841 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFEBSwitchover ::= { jnxChassisTraps 13 }
Undefined identifier: jnxChassisTraps near line 1824 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruCheck ::= { jnxChassisTraps 12 }
Undefined identifier: jnxChassisTraps near line 1807 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruOnline ::= { jnxChassisTraps 11 }
Undefined identifier: jnxChassisTraps near line 1791 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruOffline ::= { jnxChassisTraps 10 }
Undefined identifier: jnxChassisTraps near line 1772 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruFailed ::= { jnxChassisTraps 9 }
Undefined identifier: jnxChassisTraps near line 1756 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruPowerOn ::= { jnxChassisTraps 8 }
Undefined identifier: jnxChassisTraps near line 1737 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruPowerOff ::= { jnxChassisTraps 7 }
Undefined identifier: jnxChassisTraps near line 1718 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruInsertion ::= { jnxChassisTraps 6 }
Undefined identifier: jnxChassisTraps near line 1702 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFruRemoval ::= { jnxChassisTraps 5 }
Undefined identifier: jnxChassisTraps near line 1686 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxRedundancySwitchover ::= { jnxChassisTraps 4 }
Undefined identifier: jnxChassisTraps near line 1664 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxOverTemperature ::= { jnxChassisTraps 3 }
Undefined identifier: jnxChassisTraps near line 1648 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxFanFailure ::= { jnxChassisTraps 2 }
Undefined identifier: jnxChassisTraps near line 1632 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxPowerSupplyFailure ::= { jnxChassisTraps 1 }
Undefined identifier: jnxChassisTraps near line 1616 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
Unlinked OID in JUNIPER-MIB: jnxBoxAnatomy ::= { jnxMibs 1 }
Undefined identifier: jnxMibs near line 22 of /opt/snmp_exporter/generator/mibs/junos/JUNIPER-MIB
JUNIPER-MIB::jnxOperatingTable: Unknown Object Identifier



vishnu...@gmail.com

unread,
Aug 9, 2023, 11:12:36 PM8/9/23
to Prometheus Users
Moving the MIB files directly under the mibs folder fixed the issue. 
Previously it was kept under the mibs/junos/ folder 

Thanks,
Vishnu

Brian Candler

unread,
Aug 10, 2023, 9:32:54 AM8/10/23
to Prometheus Users
> when i do ./generator generate it is looking at the /usr/share/snmp/mibs/ folder insted of the snmp_exporter/generator/mibs/ folder is there any option to include the snmp_exporter/generator/mibs/ in the lookup

Yes, you can set the appropriate environment variables for libsnmp.

See "man snmpcmd" for more info (at the bottom under heading "ENVIRONMENT VARIABLES"), and you will also find an example in generator/Makefile:

generate: generator mibs
        MIBDIRS=$(MIB_PATH) ./generator --fail-on-parse-errors generate

Reply all
Reply to author
Forward
0 new messages