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

Log snmpv3 auth failures #8917

Merged
merged 6 commits into from
Apr 13, 2021
Merged

Log snmpv3 auth failures #8917

merged 6 commits into from
Apr 13, 2021

Conversation

Hipska
Copy link
Contributor

@Hipska Hipska commented Mar 1, 2021

While I still believe this is a check that gosnmp should do, let's not wait for them to implement.

Fixes #7929 as no metrics with strange values will be produced, instead telegraf will return a clear error message.
Closes #8215 since there is no feedback from original author.

Required for all PRs:

  • Associated README.md updated.
  • Has appropriate unit tests.

DouglasHeriot and others added 2 commits October 2, 2020 23:11
gosnmp does not return any error when an SNMP get request fails due to authentication.
The SNMP agent will return a "report" PDU instead of a "get-response" PDU in this case.

A check has been added to verify the packet's PDUType is not "Report"
@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Mar 1, 2021
Copy link
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

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

🤝 ✅ CLA has been signed. Thank you!

@Hipska Hipska added the error handling Issues related to error handling label Mar 2, 2021
plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
@Hipska Hipska requested a review from reimda March 5, 2021 15:19
@Hipska
Copy link
Contributor Author

Hipska commented Mar 23, 2021

Hi @reimda I have added some hardcoded messages for the most common types of report that will be received. What do you think of that?

@Hipska
Copy link
Contributor Author

Hipska commented Mar 25, 2021

There is something going on with gosnmp/gosnmp#314 but I'm not yet convinced it is good yet.

@Hipska Hipska added the plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins label Mar 26, 2021
@Hipska
Copy link
Contributor Author

Hipska commented Mar 26, 2021

Okay, we can go. When a new version of gosnmp is released, I will update our check..

@reimda
Copy link
Contributor

reimda commented Mar 29, 2021

With gosnmp/gosnmp#314 merged it sounds like we should change our approach for this PR. If we update gosnmp we won't need to hard code the USM report OIDs, and we can use the improved error message that Get() returns instead of adding our own.

@Hipska
Copy link
Contributor Author

Hipska commented Mar 30, 2021

Indeed, so maybe we can already merge this and adapt the improvements when gosnmp releases a new version afterwards?

@reimda
Copy link
Contributor

reimda commented Mar 30, 2021

I was thinking since the gosnmp PR has been merged and since go mod lets us depend on any commit in a library, we don't need to wait for a new gosnmp release. We could go get github.com/gosnmp/gosnmp@a3738642b2d1 to use the latest from gosnmp. That would let us fix the auth failures now and in the way we expect to use long-term.

I ordinarily avoid using prerelease libraries, but looking at gosnmp's history, besides PR 314 there is only one other code change since the 1.30.0 release and it's pretty simple. In this case using a prerelease doesn't introduce much risk.

Gosnmp seems to be making releases every few months and 1.30.0 came out a month ago. If we don't use a prerelease version we will likely have to wait a month or two for a release before we come back to this.

@TimRots
Copy link

TimRots commented Apr 5, 2021

Gosnmp seems to be making releases every few months and 1.30.0 came out a month ago. If we don't use a prerelease version we will likely have to wait a month or two for a release before we come back to this.

Sorry for the hold-up. Released gosnmp v1.31.0 today.

Thanks again @Hipska for your help

@Hipska
Copy link
Contributor Author

Hipska commented Apr 5, 2021

Great! I think I’ll have time this week to implement this.

@reimda
Copy link
Contributor

reimda commented Apr 5, 2021

Gosnmp seems to be making releases every few months and 1.30.0 came out a month ago. If we don't use a prerelease version we will likely have to wait a month or two for a release before we come back to this.

Sorry for the hold-up. Released gosnmp v1.31.0 today.

@TimRots Thanks for your work on gosnmp and for releasing 1.31.0! I was clearly too pessimistic about release scheduling. Having a gosnmp release that includes gosnmp/gosnmp#314 is great for this PR.

@TimRots
Copy link

TimRots commented Apr 7, 2021

@TimRots Thanks for your work on gosnmp and for releasing 1.31.0!

Thank you @reimda. Happy to help out :)

I was clearly too pessimistic about release scheduling.

Since gosnmp became a community effort we try to do a monthly release, but it still depends on how much time we have to work on things. If a bug is urgent and we try to move forward quicker ofc.

Having a gosnmp release that includes gosnmp/gosnmp#314 is great for this PR.

314 landed really nice with the help from hipska and superq. Will keep an eye on this pr to see how it works out here :)

@Hipska Hipska requested a review from ivorybilled April 12, 2021 15:09
@Hipska
Copy link
Contributor Author

Hipska commented Apr 12, 2021

Hi @reimda, can you please review again?

Copy link
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@reimda reimda left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Apr 13, 2021
@jessingrass jessingrass merged commit 4b2e2c5 into influxdata:master Apr 13, 2021
@Hipska Hipska deleted the snmp/auth branch April 20, 2021 06:56
reimda pushed a commit that referenced this pull request Apr 28, 2021
(cherry picked from commit 4b2e2c5)
@Stomper98
Copy link

I am still seeing this issue on Centos 7 with Telegraf 1.21.2. We get massive amount of hostnames with random numeric values when a remote SNMPv3 service fails connection. Following through on all the tickets about this issue with gosnmp, is there a fix in sight ?

@Hipska
Copy link
Contributor Author

Hipska commented Feb 2, 2022

@Stomper98 whoosh this is a fix/Pr that has been merged a very long time ago. So on our end there is nothing to be fixed since we didn’t got any reports on it anymore.

if you experience any snmpv3 issues, please create a new bug with your relevant config and log messages, so we can look into it.

arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp error handling Issues related to error handling fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random integers in SNMP Input Plugin OID output
8 participants