Skip to content

Allow configuring SNMP version and credentials through parameters #762

Open
@daenney

Description

@daenney

With the current design, the SNMP version to use, the community string and auth credentials (for v3) are part of the module that the generator creates. If my understanding of how this works is correct, it implies that if you want to scrape 2 devices but they have a different SNMP community (or one that has been reconfigured away from the 'public' default), you end up needing to add a new module.

This results in a ton of duplication in snmp.yml, where the only difference is the version field or some keys of the auth dictionary. For example a couple of my D-Link switches are perfectly happy to be queried using if_mib, but only support SNMPv1.

This would add a bunch of parameters on

snmp_exporter/main.go

Lines 72 to 87 in 8678b60

target := query.Get("target")
if len(query["target"]) != 1 || target == "" {
http.Error(w, "'target' parameter must be specified once", 400)
snmpRequestErrors.Inc()
return
}
moduleName := query.Get("module")
if len(query["module"]) > 1 {
http.Error(w, "'module' parameter must only be specified once", 400)
snmpRequestErrors.Inc()
return
}
if moduleName == "" {
moduleName = "if_mib"
}
like version, auth_community etc. if there's a need to override the default for a target.

I'm wondering if:

  • If there's a better way to go about this (i.e is there some way to do this without needing to go through separate modules)?
  • This is a change that the maintainers would be willing to accept?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions