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?

在2022年12月6日星期二 UTC+8 22:23:59<Brian Candler> 写道:

> 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.
>
> On Tuesday, 6 December 2022 at 13:23:01 UTC [email protected] wrote:
>
>> 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?
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/ff358f0d-3c58-4131-94dc-13d36e770f71n%40googlegroups.com.

Reply via email to