Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookups returning empty strings on Checkpoint MIB #1073

Closed
JDA88 opened this issue Dec 12, 2023 · 13 comments
Closed

Lookups returning empty strings on Checkpoint MIB #1073

JDA88 opened this issue Dec 12, 2023 · 13 comments

Comments

@JDA88
Copy link

JDA88 commented Dec 12, 2023

Host operating system: output of uname -a

Windows 2019

snmp_exporter version: output of snmp_exporter -version

snmp_exporter, version 0.25.0 (branch: HEAD, revision: 9c42d6c874d479314e612bca69558c81f8e26287)
  build user:       root@085768eb2e29
  build date:       20231210-10:04:40
  go version:       go1.21.5
  platform:         windows/amd64
  tags:             netgo

What device/snmpwalk OID are you using?

Checkpoint 6200 chkpnt.mib R81.20

If this is a new device, please link to the MIB(s).

MIB available here

What did you do that produced an error?

Two modules in generator.yml:

  checkpoint_nolookups_test:
    max_repetitions: 25
    retries: 3
    timeout: 5s
    walk:
      - fanSpeedSensorName   #1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      - fanSpeedSensorStatus #1.3.6.1.4.1.2620.1.6.7.8.2.1.6


  checkpoint_lookups_test:
    max_repetitions: 25
    retries: 3
    timeout: 5s
    walk:
      - fanSpeedSensorName   #1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      - fanSpeedSensorStatus #1.3.6.1.4.1.2620.1.6.7.8.2.1.6
    lookups:
      - source_indexes: [fanSpeedSensorIndex]
        lookup: fanSpeedSensorName
        drop_source_indexes: false

output in snmp.yml:

  checkpoint_nolookups_test:
    walk:
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
    metrics:
    - name: fanSpeedSensorName
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      type: DisplayString
      help: Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
    - name: fanSpeedSensorStatus
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      type: gauge
      help: Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
    max_repetitions: 25
    retries: 3
    timeout: 5s


  checkpoint_lookups_test:
    walk:
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
    metrics:
    - name: fanSpeedSensorName
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      type: DisplayString
      help: Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
      lookups:
      - labels:
        - fanSpeedSensorIndex
        labelname: fanSpeedSensorName
        oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
        type: DisplayString
    - name: fanSpeedSensorStatus
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      type: gauge
      help: Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
      lookups:
      - labels:
        - fanSpeedSensorIndex
        labelname: fanSpeedSensorName
        oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
        type: DisplayString
    max_repetitions: 25
    retries: 3
    timeout: 5s

What did you expect to see?

# HELP fanSpeedSensorStatus Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
# TYPE fanSpeedSensorStatus gauge
fanSpeedSensorStatus{fanSpeedSensorIndex="1",fanSpeedSensorName="System Fan 1"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="2",fanSpeedSensorName="System Fan 2"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="3",fanSpeedSensorName="System Fan 3"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="4",fanSpeedSensorName="System Fan 4"} 0

What did you see instead?

checkpoint_nolookups_test return:

# HELP fanSpeedSensorName Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
# TYPE fanSpeedSensorName gauge
fanSpeedSensorName{fanSpeedSensorIndex="1",fanSpeedSensorName="System Fan 1"} 1
fanSpeedSensorName{fanSpeedSensorIndex="2",fanSpeedSensorName="System Fan 2"} 1
fanSpeedSensorName{fanSpeedSensorIndex="3",fanSpeedSensorName="System Fan 3"} 1
fanSpeedSensorName{fanSpeedSensorIndex="4",fanSpeedSensorName="System Fan 4"} 1
# HELP fanSpeedSensorStatus Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
# TYPE fanSpeedSensorStatus gauge
fanSpeedSensorStatus{fanSpeedSensorIndex="1"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="2"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="3"} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="4"} 0

checkpoint_lookups_test return:

# HELP fanSpeedSensorName Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
# TYPE fanSpeedSensorName gauge
fanSpeedSensorName{fanSpeedSensorIndex="1",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorIndex="2",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorIndex="3",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorIndex="4",fanSpeedSensorName=""} 1
# HELP fanSpeedSensorStatus Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
# TYPE fanSpeedSensorStatus gauge
fanSpeedSensorStatus{fanSpeedSensorIndex="1",fanSpeedSensorName=""} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="2",fanSpeedSensorName=""} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="3",fanSpeedSensorName=""} 0
fanSpeedSensorStatus{fanSpeedSensorIndex="4",fanSpeedSensorName=""} 0

No matter what I tested I cannot find a way to match fanSpeedSensorName on tempertureSensorIndex and the fanSpeedSensorName end up empty. I never faced this on any mibs.
Other lookups like ifIndex > ifName works just fine, but every lookup under 1.3.6.1.4.1.2620.* fail.
Debug log show no issues on walking and the nolookups version cant get the value just fine.

@JDA88 JDA88 changed the title Lookup failing on Checkpoint MIB Lookups returning empty strings on Checkpoint MIB Dec 12, 2023
@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

Can you share the snmp.yml output as well?

@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

Can you share the snmp.yml output as well?

Orriginal post updated with the snmp.yml output.

@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

That is extremely strange. Would you mind testing with v0.24.1? I wonder if this is related to #782.

@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

I was developing with v0.24.1 and tested with v0.25 just to be sure. Same behavior.
It is indeed very strange, never saw this, I tested with multiples targets, same results.
Same with tempertureSensorName / tempertureSensorStatus / tempertureSensorIndex

Adding this MIB make sysDescr resolve as 1.3.6.1.4.1.2620.1.6.23.1 and not the 1.3.6.1.2.1.1.1 but i dont think it's related

@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

Yea, I have never seen lookup strings fail like that. Maybe try all the way back to 0.23.0 and 0.22.0? There have been a few misc changes to the lookups over the last few versions.

@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

I just tested v0.23, Same behavior!

PS: Forget what I told previously about the format version

@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

v0.22 with the old format, Same behavior! oO

Debug logs :

ts=2023-12-12T15:24:12.675Z caller=main.go:157 level=info msg="Starting snmp_exporter" version="(version=0.22.0, branch=HEAD, revision=7b0657fd99862a47f2f9f780f08a794ca7040ae7)"
ts=2023-12-12T15:24:12.677Z caller=main.go:158 level=info build_context="(go=go1.20.5, platform=windows/amd64, user=root@3f2e67d54ed1, date=20230615-13:35:05, tags=netgo)"
ts=2023-12-12T15:24:12.698Z caller=tls_config.go:274 level=info msg="Listening on" address=10.0.0.1:443
ts=2023-12-12T15:24:12.698Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=10.0.0.1:443
ts=2023-12-12T15:24:22.699Z caller=main.go:106 level=debug module=checkpoint_lookups_test target=target01.domain msg="Starting scrape"
ts=2023-12-12T15:24:22.706Z caller=collector.go:254 level=debug module=checkpoint_lookups_test target=target01.domain msg="Walking subtree" oid=1.3.6.1.4.1.2620.1.6.7.8.2.1.2
ts=2023-12-12T15:24:22.717Z caller=collector.go:268 level=debug module=checkpoint_lookups_test target=target01.domain msg="Walk of subtree completed" oid=1.3.6.1.4.1.2620.1.6.7.8.2.1.2 duration_seconds=11.0427ms
ts=2023-12-12T15:24:22.718Z caller=collector.go:254 level=debug module=checkpoint_lookups_test target=target01.domain msg="Walking subtree" oid=1.3.6.1.4.1.2620.1.6.7.8.2.1.6
ts=2023-12-12T15:24:22.719Z caller=collector.go:268 level=debug module=checkpoint_lookups_test target=target01.domain msg="Walk of subtree completed" oid=1.3.6.1.4.1.2620.1.6.7.8.2.1.6 duration_seconds=1.053ms
ts=2023-12-12T15:24:22.720Z caller=main.go:117 level=debug module=checkpoint_lookups_test target=target01.domain msg="Finished scrape" duration_seconds=0.0199731

@SuperQ SuperQ added the bug label Dec 12, 2023
@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

Ok, sorry if I’m saying something completely stupid but browsing the SNMP on this device with “FrameFlow SNMP Browser” I noticed this:
image
VS
image

for the fanSpeedSensorName it looks like the OID for the first value is 1.3.6.1.4.1.2620.1.6.7.8.2.1.2.1.0 and not 1.3.6.1.4.1.2620.1.6.7.8.2.1.2.1 with an additional zero after the index. I don't if it's expected?

This

  checkpoint_nolookups_test:
    walk:
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2.1.0
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2.2

return:

# HELP fanSpeedSensorName Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2.1.0
# TYPE fanSpeedSensorName gauge
fanSpeedSensorName{fanSpeedSensorIndex="1",fanSpeedSensorName="System Fan 1"} 1
fanSpeedSensorName{fanSpeedSensorIndex="2",fanSpeedSensorName="System Fan 2"} 1

So both works, but maybe it mess up the lookups?

@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

That does appear to be either a device bug (an additional octet) or a MIB bug (missing 2-dimension index).

Right now, the listed single value index does not match what the snmpwalk returns. That's why the lookup result is empty.

@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

As a workaround, you could try manually modifying the index in the snmp.yml.

  checkpoint_lookups_test:
    walk:
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
    - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
    metrics:
    - name: fanSpeedSensorName
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      type: DisplayString
      help: Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
      - labelname: fanSpeedSensorCheckpointLol
        type: gauge
      lookups:
      - labels:
        - fanSpeedSensorIndex
        labelname: fanSpeedSensorName
        oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
        type: DisplayString
    - name: fanSpeedSensorStatus
      oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      type: gauge
      help: Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
      indexes:
      - labelname: fanSpeedSensorIndex
        type: gauge
      - labelname: fanSpeedSensorCheckpointLol
        type: gauge
      lookups:
      - labels:
        - fanSpeedSensorIndex
        - fanSpeedSensorCheckpointLol
        labelname: fanSpeedSensorName
        oid: 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
        type: DisplayString
    max_repetitions: 25
    retries: 3
    timeout: 5s

@JDA88
Copy link
Author

JDA88 commented Dec 12, 2023

This MIB is indeed a mess, the tempertureSensorValue is stored as a string and need regex_extracts to be converted as a value...

Your workaround works, I get this:

# HELP fanSpeedSensorName Sensor name - 1.3.6.1.4.1.2620.1.6.7.8.2.1.2
# TYPE fanSpeedSensorName gauge
fanSpeedSensorName{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="1",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="2",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="3",fanSpeedSensorName=""} 1
fanSpeedSensorName{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="4",fanSpeedSensorName=""} 1
# HELP fanSpeedSensorStatus Sensor is out of range TRUE(1), FALSE(0), READING ERROR(2) - 1.3.6.1.4.1.2620.1.6.7.8.2.1.6
# TYPE fanSpeedSensorStatus gauge
fanSpeedSensorStatus{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="1",fanSpeedSensorName="System Fan 1"} 0
fanSpeedSensorStatus{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="2",fanSpeedSensorName="System Fan 2"} 0
fanSpeedSensorStatus{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="3",fanSpeedSensorName="System Fan 3"} 0
fanSpeedSensorStatus{fanSpeedSensorCheckpointLol="0",fanSpeedSensorIndex="4",fanSpeedSensorName="System Fan 4"} 0

Any way to implement this in the generator.yml?

@SuperQ
Copy link
Member

SuperQ commented Dec 12, 2023

You would need to modify the MIB to add an additional index field. That would allow the generator to handle it correctly.

I would contact the vendor if you have a support contract to see if they know about this problem.

@JDA88
Copy link
Author

JDA88 commented Dec 13, 2023

I never edted a MIB, I'll probably stick to recording rules or editing the snmp.yml for the moment.
Thank you very much for your help

@SuperQ SuperQ closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants