snmp_exorter got "was collected before with the same name and label values"

980 views
Skip to first unread message

Wang Yngwie

unread,
Dec 6, 2022, 8:23:01 AM12/6/22
to Prometheus Users
Hi everybody, I got a problem that the entIndex "289.1" can not be parsed correctly。
snmp_exporter html:
```
collected metric "devPowerStatus" { label:<name:"entIndex" value:"0x2101" > gauge:<value:1 > } was collected before with the same name and label values
```


snmpwalk 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6:
```
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.289.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.290.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.291.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.545.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.546.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.547.1 = INTEGER: 1
```
snmp_exporter config:
```
   - name: devPowerStatus
      oid: 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6
      type: gauge
      help: The current state of the device power
      indexes:
        - labelname: entIndex
          type: OctetString
          implied: true
```
Something maybe wrong with the indexes config, could someone help me?

Brian Candler

unread,
Dec 6, 2022, 9:23:59 AM12/6/22
to Prometheus Users
What it says is, you're generating the same metric two or more times (with identical set of labels):

devPowerStatus{entIndex="0x2101"} 1

If you hit snmp_exporter with curl you should be able to confirm whether or not this is the case.

curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
 
If that's the case, then you need to fix your exporter config.  You haven't shown your generator.yml nor described the MIBs you're reading, but 2011 is the enterprise ID for Huawei.

Wang Yngwie

unread,
Dec 6, 2022, 10:11:53 PM12/6/22
to Prometheus Users
Thanks @Brain :)

Let me describe the problem in more detail.
1. It's a HUAWEI S5335-S48T4X, software,Version 5.170 (S5335 V200R019C10SPC500)
2. I do not have its MIB but just a OID doc, the OID of hwEntityFanState  is 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
3. My snmp config is
```
switch_huawei_gen:
  version: 2
  auth:
    community: foo
  retries: 0
  timeout: 3m
  walk:
    - 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7 # fanStatus
  metrics:
    - name: devFanStatus
      oid: 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
      type: gauge
      help: The current state of the device fan.
      indexes:
        - labelname: entIndex
          type: OctetString
      enum_values:
        1: normal
        2: abnormal
```
4. snmpwalk result:
```
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.0 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.1 = INTEGER: 1
```
5. curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
```
An error has occurred while serving metrics:

1 error(s) occurred:
* collected metric "devFanStatus" { label:<name:"entIndex" value:"" > gauge:<value:1 > } was collected before with the same name and label values
```

I think the entIndex should be unique in OctetString, but snmp_exporter doesn't think so.
How can I fix it?

Brian Candler

unread,
Dec 7, 2022, 3:14:39 AM12/7/22
to Prometheus Users
OK, so you're writing snmp.yml by hand, without using generator, and without access to the MIB files.  This makes it harder.

The examples you gave both seem to have two OID parts as their table index:

SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.289.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.290.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.0 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.1 = INTEGER: 1

If we could see the MIB files then we could understand what they represent.

Without the docs and without having such a device to test I can't really help. However you could look at some of the examples in snmp.yml where the table index has two parts and/or is more than one OID component:

  - name: upsAdvBatteryCurrentTableIndex
    oid: 1.3.6.1.4.1.318.1.1.1.2.2.14.1.1
    type: gauge
    help: The Battery Frame identifier - 1.3.6.1.4.1.318.1.1.1.2.2.14.1.1
    indexes:
    - labelname: upsAdvBatteryCurrentTableIndex
      type: gauge
    - labelname: upsAdvBatteryCurrentIndex
      type: gauge

or:

    indexes:
    - labelname: bsnAPDot3MacAddress
      type: PhysAddress48
      fixed_size: 6
    - labelname: bsnAPIfSlotId
      type: gauge

or

    indexes:
    - labelname: virtualServerIndex
      type: gauge
    - labelname: realServerIndex
      type: gauge

Wang Yngwie

unread,
Dec 7, 2022, 8:23:58 AM12/7/22
to Prometheus Users
You really helped me, I just don't know that indexes can be a list.
Appreciate you very much.

Reply all
Reply to author
Forward
0 new messages