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

Multi index #339

Merged
merged 6 commits into from
Feb 12, 2019
Merged

Multi index #339

merged 6 commits into from
Feb 12, 2019

Conversation

brian-brazil
Copy link
Contributor

Fixes #227 #180

@RichiH
Copy link
Member

RichiH commented Sep 25, 2018

Wait, what, w00t!

generator/README.md Outdated Show resolved Hide resolved
generator/README.md Outdated Show resolved Hide resolved
@RichiH
Copy link
Member

RichiH commented Sep 27, 2018 via email

generator/README.md Outdated Show resolved Hide resolved
generator/README.md Outdated Show resolved Hide resolved
@RichiH
Copy link
Member

RichiH commented Oct 4, 2018 via email

@brian-brazil
Copy link
Contributor Author

The default discourages users from having surplus labels, and it was agreed previously that use of such a thing should only be on a case-by-case basis - which you are proposing is not in line with.

@dannyk81
Copy link

Apologies for barging in 😄

But I came across this, while looking for a way to add both the ifDescr and ifAlias labels to the various if* metrics from Network devices, currently we are replacing ifIndex with ifDescr, but I would also like to have the ifAlias as a label (indeed we solve this today with group modifiers, but that really complicates things for use when querying).

This change looks interesting, but I don't think it's going to provide a solution for this particular use case, right?

@SuperQ
Copy link
Member

SuperQ commented Oct 19, 2018

@dannyk81 Yes! This will do exactly that. We're currently arguing over the final detail about having add or remove be the default behavior.

For the record, I've been using this patch to have this behavior in my configurations. Once this is merged, the patch will not be necessary.

@RichiH
Copy link
Member

RichiH commented Oct 19, 2018

FYI, we are currently deadlocked on the last open question; before that's resolved, I don't think we can merge this PR.

  • @brian-brazil strongly believes ifIndex should be dropped by default
  • I strongly believe ifIndex must be kept by default

@dannyk81
Copy link

dannyk81 commented Oct 19, 2018

Ohhh! @SuperQ great news! I guess I misunderstood how this works - apologies for the noise and hope to see this soon 🙏

But to be honest, I'm still not quite sure how the lookup should be defined with this to achieve it (wanted to take this branch for a spin):

    lookups:
    - source_indexes: [ifIndex, ifAlias]
      lookup: ifDescr
      keep_source_indexes: true

?

The result I'm looking for:

ifHCInOctets{ifIndex="<index>",ifDescr="EthernetX/Y",ifAlias="# <some text here> #",instance="<some cisco switch>",job="cisconxos-snmp-exporter"}

My 2 cents on your debate (though I don't presume it will have too much weight on your final decision 😅) is that the ifIndex should be kept around, since for me it provides a unique ID of the resource the metric represents and removing it by default seems not the best approach.

Having said that, I'm perfectly fine tuning this parameter to true myself if it means we get this thing merged and released 👍

I agree with @brian-brazil that snmp.yml should not be generated/tweaked manually and we as users try to abide by the rule/best-practice, however the reality is that we have cases where this is unavoidable, my example is the CheckPoint FW devices.

  - name: fwDropPcktsOut
    oid: 1.3.6.1.4.1.2620.1.1.25.5.1.10
    type: counter
    help: ' - 1.3.6.1.4.1.2620.1.1.25.5.1.10'
    indexes:
    - labelname: fwIfIndex
      type: gauge
    - labelname: fwIfDummyIndex
      type: gauge
    lookups:
    - labels:
      - fwIfIndex
      - fwIfDummyIndex
      labelname: fwIfName
      oid: 1.3.6.1.4.1.2620.1.1.25.5.1.2
      type: DisplayString

We modify the generated snmp.yml as described above, since the results returned from the device are incorrect and not supported by the generator (the solution was provided by Brian and Ben --> https://groups.google.com/forum/#!msg/prometheus-users/NDyO8qRlXoM/mUculDc-BQAJ)

I believe this is not a unique case, and SNMP is full of such examples, so the point is that we need to find a balance between keeping things clean and standardized on the one hand and on the other hand provide the users (us) with tools to handle the abnormal cases.

/end of rant ☮️

@SuperQ
Copy link
Member

SuperQ commented Oct 19, 2018

For ifIndex you need a configuration like this when using this patch:

    lookups:
    - source_indexes: [ifIndex]
      lookup: ifDescr
      keep_source_indexes: true
    - source_indexes: [ifIndex]
      lookup: ifAlias
      keep_source_indexes: true
    - source_indexes: [ifIndex]
      lookup: ifName
      keep_source_indexes: true

The explanation here is that the "source index" is the index on the MIB entry.

You can see that in the MIB:

ifEntry OBJECT-TYPE
    SYNTAX      IfEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "An entry containing management information applicable to a
            particular interface."
    INDEX   { ifIndex }
    ::= { ifTable 1 }

The big reason for this change is we wanted to be able to support objects that have multi-dimension indexes. For example, here's one from a wifi controller:

   wlsxWlanAPBssidEntry OBJECT-TYPE
      SYNTAX       WlanAPBssidEntry
      MAX-ACCESS   not-accessible       
      STATUS       current
      DESCRIPTION
             "BSSID Entry"
      INDEX {wlanAPMacAddress, wlanAPRadioNumber, wlanAPBSSID}
      ::= { wlsxWlanAPBssidTable 1 }

@dannyk81
Copy link

Ahhh, I see! @SuperQ, that's clear now. so the ifIndex lookup can be specified several times (each with a different lookup), I wasn't sure about that.

Thanks, this is clear now.

@dannyk81
Copy link

dannyk81 commented Nov 9, 2018

Hope to see this soon 🙏

@fjaeckel
Copy link

I'd love to see this merged, whats the holdup? :)

@SuperQ
Copy link
Member

SuperQ commented Dec 11, 2018

@fjaeckel We're stuck on agreeing on the default of keep_source_indexes.

@fjaeckel
Copy link

@SuperQ as long as we're documenting the default, whatever it may be, and its implications - we should be able to just roll with it. I think for myself ifIndex, if thats the only label, should be kept by default.

@SuperQ
Copy link
Member

SuperQ commented Dec 11, 2018

That's the issue. If you use a lookup, for ifDescr, ifIndex is dropped with the current default of false.

@fjaeckel
Copy link

That's the issue. If you use a lookup, for ifDescr, ifIndex is dropped with the current default of false.

I don't see it as a blocker, it can be overridden and should just be explained why some think its a good default.
I see a bigger issue in not merging this PR than setting a sane default, people maintain their own patch sets for snmp_exporter (and generator) - I for one do.

@dannyk81
Copy link

@SuperQ @RichiH @brian-brazil

Sorry for @ing like this, but is there any chance we can have closure on this? I desperately need this functionality and I've been avoiding using a private build of this PR until now... but seems like we're at an impasse 😞

I completely agree with @fjaeckel, as long as we have the option to change the default behavior, it should be a reasonable approach for everyone.

Please 🙏

@RichiH
Copy link
Member

RichiH commented Jan 17, 2019

I called a vote to unblock this either way. I can't stress enough that while I disagree with Brian here, I sincerely thank him for doing this.

https://groups.google.com/forum/#!topic/prometheus-developers/0eMRmiIHcsM

@SuperQ
Copy link
Member

SuperQ commented Jan 30, 2019

Can you please rebase this against master?

@brian-brazil
Copy link
Contributor Author

This is updated. Do we know which if any of the existing lookup examples are non-unique?

@SuperQ
Copy link
Member

SuperQ commented Feb 5, 2019

It's not the lookups that cause issues, it's the devices when you use them. I know HP devices will generate duplicate ifDescr="HP ProCurve Switch software loopback interface" labels when you have management IPs configured on more than one vlan. The only way to have ifDescr is by having both ifIndex and ifDescr.

@brian-brazil
Copy link
Contributor Author

ifInterfaces I've already covered, it's the others I'm wondering about.

generator/Makefile Outdated Show resolved Hide resolved
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SuperQ
Copy link
Member

SuperQ commented Feb 5, 2019

I think that should cover it for now.

Also ensure index labels are sanitized.

Signed-off-by: Brian Brazil <[email protected]>
This changes old_index to be old_indexes in generator.yml.

Signed-off-by: Brian Brazil <[email protected]>
old_indexes -> source_indexes
new_index -> lookup
keep_old -> keep_source_indexes

Signed-off-by: Brian Brazil <[email protected]>
Merge the if_mib example modules into one.

Use only the mibs we download.

Signed-off-by: Brian Brazil <[email protected]>
@SuperQ
Copy link
Member

SuperQ commented Feb 5, 2019

Looks like there's a minor difference to some metrics in the snmp.yml.

@brian-brazil
Copy link
Contributor Author

Odd, yet another run fixed it.

@RichiH
Copy link
Member

RichiH commented Feb 6, 2019

LGTM. Ideally, I would love to have a release right after merging this.

@brian-brazil
Copy link
Contributor Author

Yes, this requires an immediate release due to the nature of the changes.

@RichiH
Copy link
Member

RichiH commented Feb 6, 2019

Just to make sure: @brian-brazil is this ready to merge from your end?

@brian-brazil
Copy link
Contributor Author

Yes, I'll do it when I'm ready to release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants