snmp generator.yml fails error err="cannot find oid '1.22610.2.4.1.2.2' to walk

181 views
Skip to first unread message

Mehran Saeed

unread,
Apr 27, 2024, 5:37:03 AM4/27/24
to Prometheus Users
Hello 
I am trying to generate snmp.yml from generator but it fails. its for a10 load balancers as I needed extra mibs for CPU and memory. below is the generator.yml config. 
I have added the mib file into the correct mib directory as well. 

```
---
auths:
  public_v1:
    version: 1
  public_v2:
    version: 2

  prometheus_v3:
    username: user
    password: pwd
    auth_protocol: SHA
    priv_protocol: AES
    security_level: authPriv
    priv_password: pwd
    version: 3

 

modules:
  # Default IF-MIB interfaces table with ifIndex.
  a10:
    walk:
      - 1.22610.2.4.1.2.2





   

Mehran Saeed

unread,
Apr 27, 2024, 1:38:49 PM4/27/24
to Ben Kochie, Prometheus Users
yes sure
below are the logs whilst generating 

```
MIBDIRS='mibs' ./generator --fail-on-parse-errors generate
ts=2024-04-27T17:34:02.776Z caller=net_snmp.go:175 level=info msg="Loading MIBs" from=mibs
ts=2024-04-27T17:34:03.011Z caller=main.go:124 level=warn msg="NetSNMP reported parse error(s)" errors=3839
ts=2024-04-27T17:34:03.094Z caller=main.go:53 level=info msg="Generating config for module" module=a10
ts=2024-04-27T17:34:03.115Z caller=main.go:134 level=error msg="Error generating config netsnmp" err="cannot find oid 'axSysSecondaryVersionOnDisk' to walk
```

Also if I try generating the if-mib objects from if-mib module they work fine. 
I need to generate mibs for A10. have put the a10 mib file in the mibs directory. 
Looks like its not able to find the OIDs for a10. 


On Sat, Apr 27, 2024 at 10:38 AM Ben Kochie <sup...@gmail.com> wrote:
Can you post the logs of the `generator generate`? What about `generator parse_errors`?

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/3255afc8-e4cd-4260-b405-bf13047cd53fn%40googlegroups.com.

Alexander Wilke

unread,
Apr 27, 2024, 2:22:32 PM4/27/24
to Prometheus Users
You probably do not have alle required mibs in the folder.
Please Post the MIBs which you want to use and the generator command you used.

PS:
On top of all MIBs there are comments Like IMPORT which describes which other MIBs are needed.
Fürther use MIBv2 with names instead OIDs. Put the Name in the Generator yml Not the oid.

Ben Kochie

unread,
Apr 27, 2024, 2:36:36 PM4/27/24
to Alexander Wilke, Prometheus Users
I should really make the parse errors warning print in all caps with colors or something. 

Or maybe just fail if there is too many.

Mehran Saeed

unread,
Apr 27, 2024, 3:08:54 PM4/27/24
to Prometheus Users
Thanks for responding. 

below are the two MIBs for memory I am trying to use:

memory usage: 1.3.6.1.4.1.22610.2.4.1.2.2

Field Name : axSysMemoryUsage 
Field Type: Integer32 
Field Status : current 
Description : The usage memory(KB). 
OID : 1.3.6.1.4.1.22610.2.4.1.2.2  

memory total: 1.3.6.1.4.1.22610.2.4.1.2.1

  Field Name : axSysMemoryTotal 
Field Type: Integer32
Field Status : current 
Description : The total memory(KB). 
OID : 1.3.6.1.4.1.22610.2.4.1.2.1  


I used the cmd below to get the generator executable file:

make generate

then to run the generator ran this cmd:

./generator generate   -m /snmp_exporter/generator/mibs  -g /generator/generator.yml   -o /snmp_exporter/mib/snmp.yml


I tried changing the generator.yml file by mentioning just object id and OID but no luck

---
auths:
  public_v1:
    version: 1
  public_v2:
    version: 2


  prometheus_v3:
    username: user
    password: pwd
    auth_protocol: SHA
    priv_protocol: AES
    security_level: authPriv
    priv_password: pwd
    version: 3

modules:
 
  a10:
    walk:
      - 1.3.6.1.4.1.22610.2.4.1.2.1


Alexander Wilke

unread,
Apr 28, 2024, 12:43:25 PM4/28/24
to Prometheus Users
Is this MIB in the MIBs folder?

Mehran Saeed

unread,
Apr 29, 2024, 3:18:19 AM4/29/24
to Alexander Wilke, Prometheus Users
Yes correct thats the one 

Mehran Saeed

unread,
May 1, 2024, 6:42:06 AM5/1/24
to Prometheus Users
Just wondering if this format correct for the generator.yml as in is this how mibs or defined 

auths:
  public_v1:
    version: 1
  public_v2:
    version: 2


  prometheus_v3:
    username: user
    password: pwd
    auth_protocol: SHA
    priv_protocol: AES
    security_level: authPriv
    priv_password: pwd
    version: 3

modules:
  
  a10:
    walk:
      - 1.3.6.1.4.1.22610.2.4.1.2.1


before running the  ./generator generate \ cmd I did make generate as well to create the generator execution file. 
getting the same error no matter what I change. 

Alexander Wilke

unread,
May 3, 2024, 1:44:54 PM5/3/24
to Prometheus Users
Try this instead of oid
axSysMemory
axSysCpu

Mehran Saeed

unread,
May 4, 2024, 5:13:09 AM5/4/24
to Alexander Wilke, Prometheus Users
yeah tried without oids but still the same result. 

just to double check. 
The correct way is to clone the generator repo, add the custom mib to the mibs dir and run the make generate cmd to generate the executable generator file and then run ./generator generate to run the generator. 

not sure what I am doing wrong here. 


Alexander Wilke

unread,
May 4, 2024, 4:13:00 PM5/4/24
to Prometheus Users
Needed Mibs:
root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10# ls -la
insgesamt 272
drwxr-xr-x 2 root root     91  4. Mai 22:07 .
drwxrwxr-x 8 root root    332  4. Mai 22:07 ..
-rw-r--r-- 1 root root 261898 15. Jun 2022  A10-AX-MIB.mib
-rw-r--r-- 1 root root   4572 15. Jun 2022  A10-COMMON-MIB.mib

-rwxr-xr-x 1 root root    369  4. Mai 22:06 generator.yml
-rw-r--r-- 1 root root   3518  4. Mai 22:07 snmp.yml
root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10#


generator.yml:

root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10# cat ./generator.yml

auths:
  public_v1:
    version: 1
  public_v2:
    version: 2
  a10_device:
    version: 3
    username: Some
    password: TotallySecret
    auth_protocol: SHA
    priv_protocol: AES
    priv_password: SomeOtherSecret
    security_level: authPriv

modules:
  # A10
  a10_mibs:
    walk: [axSysMemory,axSysCpu]
    max_repetitions: 100
    timeout: 30s
    retries: 0
root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10#


generate command pointing o the default mibs in "mibs" folder and the additional mibs in "mibs_a10" folder:

root@ubiquiti:/opt/prometheus/snmp_exporter/generator# ./generator generate -m /opt/prometheus/snmp_exporter/generator/mibs/ -m /opt/prometheus/snmp_exporter/generator/mibs_a10/ -g /opt/prometheus/snmp_exporter/generator/mibs_a10/generator.yml -o /opt/prometheus/snmp_exporter/generator/mibs_a10/snmp.yml
ts=2024-05-04T20:07:04.764Z caller=net_snmp.go:175 level=info msg="Loading MIBs" from=/opt/prometheus/snmp_exporter/generator/mibs/:/opt/prometheus/snmp_exporter/generator/mibs_a10/
ts=2024-05-04T20:07:06.035Z caller=main.go:53 level=info msg="Generating config for module" module=a10_mibs
ts=2024-05-04T20:07:06.138Z caller=main.go:68 level=info msg="Generated metrics" module=a10_mibs metrics=12
ts=2024-05-04T20:07:06.141Z caller=main.go:93 level=info msg="Config written" file=/opt/prometheus/snmp_exporter/generator/mibs_a10/snmp.yml
root@ubiquiti:/opt/prometheus/snmp_exporter/generator#


result snmp.yml:
root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10# cat snmp.yml
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
auths:
  a10_device:
    community: public
    security_level: authPriv
    username: Some
    password: TotallySecret
    auth_protocol: SHA
    priv_protocol: AES
    priv_password: SomeOtherSecret
    version: 3
  public_v1:
    community: public
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 1
  public_v2:
    community: public
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 2
modules:
  a10_mibs:
    walk:
    - 1.3.6.1.4.1.22610.2.4.1.2
    - 1.3.6.1.4.1.22610.2.4.1.3
    metrics:
    - name: axSysMemoryTotal
      oid: 1.3.6.1.4.1.22610.2.4.1.2.1
      type: gauge
      help: The total memory(KB). - 1.3.6.1.4.1.22610.2.4.1.2.1
    - name: axSysMemoryUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.2.2
      type: gauge
      help: The usage memory(KB). - 1.3.6.1.4.1.22610.2.4.1.2.2
    - name: axSysCpuNumber
      oid: 1.3.6.1.4.1.22610.2.4.1.3.1
      type: gauge
      help: The cpu number in a10System - 1.3.6.1.4.1.22610.2.4.1.3.1
    - name: axSysCpuIndex
      oid: 1.3.6.1.4.1.22610.2.4.1.3.2.1.1
      type: gauge
      help: The index of the CPU. - 1.3.6.1.4.1.22610.2.4.1.3.2.1.1
      indexes:
      - labelname: axSysCpuIndex
        type: gauge
    - name: axSysCpuUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.3.2.1.2
      type: DisplayString
      help: The CPU Usage. - 1.3.6.1.4.1.22610.2.4.1.3.2.1.2
      indexes:
      - labelname: axSysCpuIndex
        type: gauge
    - name: axSysCpuUsageValue
      oid: 1.3.6.1.4.1.22610.2.4.1.3.2.1.3
      type: gauge
      help: The CPU usage value. - 1.3.6.1.4.1.22610.2.4.1.3.2.1.3
      indexes:
      - labelname: axSysCpuIndex
        type: gauge
    - name: axSysAverageCpuUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.3.3
      type: gauge
      help: The average CPU usage in last 5 seconds. - 1.3.6.1.4.1.22610.2.4.1.3.3
    - name: axSysAverageControlCpuUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.3.4
      type: gauge
      help: The average control CPU usage in last 5 seconds. - 1.3.6.1.4.1.22610.2.4.1.3.4
    - name: axSysAverageDataCpuUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.3.5
      type: gauge
      help: The average data CPU usage in last 5 seconds. - 1.3.6.1.4.1.22610.2.4.1.3.5
    - name: axSysCpuIndexInUsage
      oid: 1.3.6.1.4.1.22610.2.4.1.3.6.1.1
      type: gauge
      help: The index of the CPU - 1.3.6.1.4.1.22610.2.4.1.3.6.1.1
      indexes:
      - labelname: axSysCpuIndexInUsage
        type: gauge
      - labelname: axSysCpuUsagePeriodIndex
        type: gauge
    - name: axSysCpuUsagePeriodIndex
      oid: 1.3.6.1.4.1.22610.2.4.1.3.6.1.2
      type: gauge
      help: 'The CPU usage sampling period: 1: 1-second sampling, 2: 5-second sampling,
        3: 10-second sampling, 4: 30-second sampling, 5: 60-second sampling. - 1.3.6.1.4.1.22610.2.4.1.3.6.1.2'
      indexes:
      - labelname: axSysCpuIndexInUsage
        type: gauge
      - labelname: axSysCpuUsagePeriodIndex
        type: gauge
    - name: axSysCpuUsageValueAtPeriod
      oid: 1.3.6.1.4.1.22610.2.4.1.3.6.1.3
      type: gauge
      help: The CPU usage value at given period, 1-sec, 5-sec, 10-sec, 30-sec, and
        60-sec. - 1.3.6.1.4.1.22610.2.4.1.3.6.1.3
      indexes:
      - labelname: axSysCpuIndexInUsage
        type: gauge
      - labelname: axSysCpuUsagePeriodIndex
        type: gauge
    max_repetitions: 100
    retries: 0
    timeout: 30s
root@ubiquiti:/opt/prometheus/snmp_exporter/generator/mibs_a10#


Mehran Saeed

unread,
May 6, 2024, 12:27:54 PM5/6/24
to Alexander Wilke, Prometheus Users
Hello Alex 
Thanks for looking into it. I really appreciate that. 

I am able to generate the oids now. I wasn't aware that I need to make sure of this file as well "A10-COMMON-MIB.txt" which is the root file 

Thanks again 

Ben Kochie

unread,
May 6, 2024, 12:58:48 PM5/6/24
to Mehran Saeed, Alexander Wilke, Prometheus Users
FYI, I just checked in a change to the generator that makes missing MIB files a lot more obvious.

https://github.com/prometheus/snmp_exporter/pull/1167

If you pull latest main and build the generator it will try and tell you exactly which MIB modules are missing from the mibs directories.

We're going to cut a new release soon with this functionality as well.

Reply all
Reply to author
Forward
0 new messages