Giter VIP home page Giter VIP logo

Comments (12)

brian-brazil avatar brian-brazil commented on May 16, 2024 1
   - name: hrProcessorLoad
      oid: 1.3.6.1.2.1.25.3.3.1.2
      type: Integer32
      indexes:
          - labelname: cpu
            type: Integer32

should do it offhand.

from snmp_exporter.

RichiH avatar RichiH commented on May 16, 2024

You match that to the table with the CPU core descriptions. Look at ifDescr for how this works.

from snmp_exporter.

RichiH avatar RichiH commented on May 16, 2024

@brian-brazil For clarification: If you omit lookups, the index simply assigns the last number in a OID to the label as its value?

from snmp_exporter.

brian-brazil avatar brian-brazil commented on May 16, 2024

It's two stages. Indexes extracts indexes as labels. Lookups lets you add/replace labels based on lookups of the tree.

from snmp_exporter.

RichiH avatar RichiH commented on May 16, 2024

Ah, neat. Never understood it that way, but makes sense in hindsight. Thanks :)

from snmp_exporter.

RichiH avatar RichiH commented on May 16, 2024

@paurullan Still, if you have a table with human-readable descriptions (unlikely in this specific case, mind), going via lookups might be preferable.

from snmp_exporter.

paurullan avatar paurullan commented on May 16, 2024

@brian-brazil fantastic, thank you. The example worked great for the CPUs.

Now I have another similar case but with a twist: the router exposes the traffic for the external ports in the same OID walk than the dynamic clients (it is behind a PON port). Currently it has more than 3500+ items, I only need a list of 20 and the exporter only outputs around a hundred.

@RichiH , you said «going via lookups» but I could not fully understand how. This is my draft; how would you do it?

  metrics:
    - name: portOutput
      oid: 1.3.6.1.2.1.31.1.1.1.10
      type: Integer32
      indexes:
        - labelname: port
          type: Integer32
   #  lookups:
   #    - labels: [port]
   #      labelname: port
   #      values:                                                                              
   #        - "11004"
   #        - "10204"

from snmp_exporter.

paurullan avatar paurullan commented on May 16, 2024

We talked about this two weeks ago and there has been no advance.
I will restate my problem so I make myself clear:

I have to retrieve only 20 items from a OID that has thousand of items. How can I select the individual items?

@RichiH talked about lookups but I could not make them work. How should I proceed?

from snmp_exporter.

RichiH avatar RichiH commented on May 16, 2024

@paurullan The Prometheus way is to simply ingest those few thousand values and then ignore them in your queries. It might be counter-intuitive at first, but unless you're already resource-constrained, it will incur the least cost; human attention tends to be more expensive than hardware, in the long run.

Lookups are orthogonal to that, they simply assign a string from the snmpbulkget instead of the last section of the OID.

from snmp_exporter.

paurullan avatar paurullan commented on May 16, 2024

@RichiH the problem is that doing a full snmp walk on that OID range takes more than 50 seconds.

But I found a way to cross the lookup with strings:

~$  snmpbulkget 10.40.0.10 -v 2c -c public 1.3.6.1.2.1.31.1
iso.3.6.1.2.1.31.1.1.1.1.101 = STRING: "Ethport 1/1/g1"
iso.3.6.1.2.1.31.1.1.1.1.102 = STRING: "Ethport 1/1/g2"
iso.3.6.1.2.1.31.1.1.1.1.103 = STRING: "Ethport 1/1/g3"
iso.3.6.1.2.1.31.1.1.1.1.104 = STRING: "Ethport 1/1/g4"
iso.3.6.1.2.1.31.1.1.1.1.201 = STRING: "Ethport 1/2/g1"
iso.3.6.1.2.1.31.1.1.1.1.202 = STRING: "Ethport 1/2/g2"
iso.3.6.1.2.1.31.1.1.1.1.203 = STRING: "Ethport 1/2/g3"
iso.3.6.1.2.1.31.1.1.1.1.204 = STRING: "Ethport 1/2/g4"
iso.3.6.1.2.1.31.1.1.1.1.301 = STRING: "Ethport 2/1/g1"
iso.3.6.1.2.1.31.1.1.1.1.302 = STRING: "Ethport 2/1/g2"
---
# Connection output for the PONs
default:
  walk:
    - 1.3.6.1.2.1.31.1.1.1.6
    - 1.3.6.1.2.1.31.1.1.1.10
  metrics:
    - name: ifHCInOctets
      oid: 1.3.6.1.2.1.31.1.1.1.6
      indexes:
        - labelname: ifMIBObjects
          type: Integer32
      lookups:
        - labels: [ifMIBObjects]
          labelname: ifMIBObjects
          oid: 1.3.6.1.2.1.31.1

This solution gives me lots of unnecessary items but it will do.
Was this the lookup way you mentioned?

from snmp_exporter.

Colstuwjx avatar Colstuwjx commented on May 16, 2024

Hi @brian-brazil , I met this issue in my env as my OID output likes:

SNMPv2-SMI::enterprises.2011.6.3.4.1.2.0.2.0 = INTEGER: 61
SNMPv2-SMI::enterprises.2011.6.3.4.1.2.0.3.0 = INTEGER: 77
SNMPv2-SMI::enterprises.2011.6.3.4.1.2.0.4.0 = INTEGER: 14
SNMPv2-SMI::enterprises.2011.6.3.4.1.2.0.5.0 = INTEGER: 4

Index didn't work anymore due to the last number is always 0, any idea about this...

from snmp_exporter.

SuperQ avatar SuperQ commented on May 16, 2024

@Colstuwjx This should work fine, for usage questions, please us our community contacts. GitHub issues are for bugs/features only.

from snmp_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.