forked from mccleve/prtg-pagerduty
-
Notifications
You must be signed in to change notification settings - Fork 1
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
100 Character Length Bugfix #3
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As it turns out, PagerDuty has an undocumented 100 character limit on the "client:" JSON key. This key is not critical at all to the alerting process, as it only exists to show the name of the Integration so that it can be linked to. This has now just been hardcoded to show "PRTG" as that is the only necessary information.
I have added a new function called "truncateString()" that (believe it or not) allows you to... truncate a string. This was added as a response to the 100 Character Length issue. Now this function is called on most strings before they go into the JSON marshaling function in event.go and get sent to PagerDuty, hopefully alleviating any length-based issues with PagerDuty
I have also added a new int flag to set how long to truncate all of the fields to (except summary and custom_details, which testing does not show any character limits on.)
We still need to come up with a method for handling errors and logging/alerting on them appropriately, but that will likely need to come in a larger re-working of this integration.