-
Notifications
You must be signed in to change notification settings - Fork 488
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
Telegram Alerting #680
Telegram Alerting #680
Conversation
return err | ||
} | ||
type response struct { | ||
Error string `json:"error"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the docs here is looks like errors are of the form
{
"ok" : false,
"description" : "error message here",
"error_code": 576
}
Can you update the response struct accordingly?
@burdandrei Thanks for the PR! Overall things look to be in place. I have made a few comments here and there. |
@nathanielc thanks for the review, |
@burdandrei Sounds good. As for the message text you are right that the level can be added to the message and is there by default. The part the seemed incorrect was the structure of the JSON post data itself not the content of the text. Specifically that their docs imply that it needs to be wrapped in an object under the |
@@ -18,6 +18,7 @@ | |||
|
|||
- [#636](https://github.com/influxdata/kapacitor/pull/636): Change HTTP logs to be in Common Log format. | |||
- [#652](https://github.com/influxdata/kapacitor/pull/652): Add optional replay ID to the task API so that you can get information about a task inside a running replay. | |||
- [#680](https://github.com/influxdata/kapacitor/pull/680): Add Telegram Alerting option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can you rebase off latest master and move this line to the beta3 section since beta2 has now been released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you guys are fast ;)
@nathanielc according to the docs Only required fields are chat_id and text, so I'm just pushing message to text and that's it. |
@nathanielc Take a look now |
IsDisableNotification bool `tick:"DisableNotification"` | ||
} | ||
|
||
func (tel *TelegramHandler) DisableNotification() *TelegramHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the default true? How would you set this to false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it's default false, changed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to these functions?
@nathanielc i added validation of parseMode and the fixed the disableNotification and disableWebPagePreview, to take the defaults from the config if not passed in TICK. |
} | ||
|
||
if parseMode != "Markdown" && parseMode != "HTML" { | ||
return errors.New(fmt.Sprintf("parseMode %s is not valid, please use 'Markdown' or 'HTML'", parseMode)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use fmt.Errorf here
fmt.Errorf("parseMode %s is not valid, please use 'Markdown' or 'HTML'", parseMode)
@burdandrei Looks good just a few small changes left... |
.telegram() | ||
.chatId('12345678') | ||
.disableNotification() | ||
.parseMode('HTML') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add another .telegram
call so we can show that it works with multiple handlers configured?
Ability to send messages to Telegram(https://telegram.org) Thanks to @vladshub for help!
@nethanielc Done, thanks for great tips! |
@burdandrei Thanks for the PR! |
Required for all non-trivial PRs