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

Better way to retrieve snmp setting for ifName plugin #8010

Open
Hipska opened this issue Aug 20, 2020 · 13 comments
Open

Better way to retrieve snmp setting for ifName plugin #8010

Hipska opened this issue Aug 20, 2020 · 13 comments
Labels
area/configuration area/snmp feature request Requests for new plugin and for new features to existing plugins

Comments

@Hipska
Copy link
Contributor

Hipska commented Aug 20, 2020

Feature Request

Opening a feature request kicks off a discussion.
As discussed in #7763 (comment)

Proposal:

Make it possible some way to retrieve the community string (and other snmp config) directly from the config set for the snmp input.

Current behavior:

Community string (and other snmp config) needs to be configured in ifName plugin as well

Desired behavior:

Let ifName plugin figure out from which plugin the metric comes and use the config from that plugin if possible.

Use case:

Usually each device (or group of devices) has its own specific community string and that would make a huge config even more huge.

@Hipska Hipska added the feature request Requests for new plugin and for new features to existing plugins label Aug 20, 2020
@powersj
Copy link
Contributor

powersj commented Mar 24, 2022

Hi Hipska,

Looking through old issues to get status on them.

It sounds like this is trying to not require the community config value for the ifname processor by knowing that value from the input, is that correct?

What would be required to have the processor know this in advance?

Thanks!

@powersj powersj added the waiting for response waiting for response from contributor label Mar 24, 2022
@Hipska
Copy link
Contributor Author

Hipska commented Mar 24, 2022

Correct, I think it could be possible if a metric could have a reference to the input plugin where it originated from somehow. What do you think?

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Mar 24, 2022
@Hipska
Copy link
Contributor Author

Hipska commented Mar 24, 2022

Easier to implement would be the community string could come from a tag.

@Hipska
Copy link
Contributor Author

Hipska commented Oct 16, 2023

@powersj What if I added an option to inputs.snmp which adds the required client config parameters as tags? On its turn, the processors.ifname can read from the tags?

@powersj
Copy link
Contributor

powersj commented Oct 17, 2023

@Hipska,

If we have the knowledge of what needs to get done in the snmp input plugin, why not add this as a feature of the snmp plugin?

Thanks

@Hipska
Copy link
Contributor Author

Hipska commented Nov 21, 2023

@srebhan is proposing to have a list/table of client parameters in the plugin config instead of putting the info in tags..

@Hipska
Copy link
Contributor Author

Hipska commented Nov 23, 2023

@powersj @srebhan, can you please give a descision here, so the PR can be on time for 1.29?

@powersj
Copy link
Contributor

powersj commented Nov 27, 2023

@Hipska,

@srebhan and I have been talking about this today and we need to reset our understanding. We both understanding that there is friction between how to efficiently share configuration data between the SNMP plugin and when you do lookups.

What we both do not fully understand is why we could not do this in the SNMP plugin itself? Does this really need to be a new processor?

Thanks

@Hipska
Copy link
Contributor Author

Hipska commented Nov 27, 2023

Yeah, sometimes you need another processor first to split the index if it is a combined one.

The ifname was originally created to work with the sflow input. It can also be useful with the snmp_trap plugin.

@powersj
Copy link
Contributor

powersj commented Nov 27, 2023

sometimes you need another processor first to split the index if it is a combined one

Can you give us a short example? Would go a long way to help us understand the situation better. Thanks

@Hipska
Copy link
Contributor Author

Hipska commented Nov 28, 2023

See for example TIMETRA-SAP-MIB::sapBaseStatsEntry where the index is a combination of 3 fields. 2 of them are available to gather from the table, but svcId isn't and I need that one to get the TIMETRA-SERV-MIB::svcName with snmp_lookup, so this processor comes in between:

# Parse TIMETRA-SAP-MIB::sapBaseStatsEntry index
[[processors.starlark]]
  alias = "sapBaseStatsEntry_index"
  order = 1
  namepass = ["sap"]

  ## Source of the Starlark script.
  source = '''
def apply(metric):

	index = metric.tags.pop("index", "0.0.0").split(".")

	metric.tags["svcId"] = index[0]
	metric.tags["sapPortId"] = index[1]
	metric.tags["sapEncapValue"] = index[2]

	return metric
'''

  ## Only need to run when the tag exists
  [processors.starlark.tagpass]
    index = ["*"]

A sample index we receive is: 300121.1342177331.1121 and then we want the content of TIMETRA-SERV-MIB::svcName.300121 to get the name of the service as tag on the metric.

And as said before, you can't do lookups when the functionality is embedded into inputs.snmp and the info comes from inputs.snmp_trap or inputs.sflow or others..

There is already some table merging functionality included in the snmp input, but that only works for one:one relations, not one:many or many:many relations.

@srebhan
Copy link
Member

srebhan commented Nov 30, 2023

@Hipska I see. But then how would sflow pass the required information you describe in your initial description (e.g. community string)? I think there is no sensible way around defining that data in the processor again. The only thing I see would be to share via file that all relevant plugins can include... What do you think?

@Hipska
Copy link
Contributor Author

Hipska commented Jan 30, 2024

Yes, that would probably be a better solution.

I already expressed I'm open for that as wel, I just wanted a confirmation this is the way you both want to go: #8010 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration area/snmp feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

4 participants