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

Telegram Alerting #680

Merged
merged 1 commit into from
Jun 29, 2016
Merged

Telegram Alerting #680

merged 1 commit into from
Jun 29, 2016

Conversation

burdandrei
Copy link
Contributor

@burdandrei burdandrei commented Jun 27, 2016

Required for all non-trivial PRs
  • CHANGELOG.md updated
  • Rebased/mergable
  • Sign CLA (if not already signed)
  • Tests pass

return err
}
type response struct {
Error string `json:"error"`
Copy link
Contributor

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?

@nathanielc
Copy link
Contributor

@burdandrei Thanks for the PR! Overall things look to be in place. I have made a few comments here and there.

@burdandrei
Copy link
Contributor Author

@nathanielc thanks for the review,
Error responce and camel case i'll do, missed it with all the copy-pasting from other services ;)
about the message text, i can see that there is Level in default Message, so i think leaving it as is, OK?

@nathanielc
Copy link
Contributor

nathanielc commented Jun 27, 2016

@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 message field. They don't provide examples and I haven't found a way to test locally so I am not sure. Does it work for you?

@@ -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
Copy link
Contributor

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?

Copy link
Contributor Author

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 ;)

@burdandrei
Copy link
Contributor Author

@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.

@burdandrei
Copy link
Contributor Author

@nathanielc Take a look now

IsDisableNotification bool `tick:"DisableNotification"`
}

func (tel *TelegramHandler) DisableNotification() *TelegramHandler {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

@burdandrei
Copy link
Contributor Author

burdandrei commented Jun 28, 2016

@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.
Let me know what you think =)

}

if parseMode != "Markdown" && parseMode != "HTML" {
return errors.New(fmt.Sprintf("parseMode %s is not valid, please use 'Markdown' or 'HTML'", parseMode))
Copy link
Contributor

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)

@nathanielc
Copy link
Contributor

@burdandrei Looks good just a few small changes left...

.telegram()
.chatId('12345678')
.disableNotification()
.parseMode('HTML')
Copy link
Contributor

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!
@burdandrei
Copy link
Contributor Author

@nethanielc Done, thanks for great tips!

@nathanielc nathanielc merged commit b56550e into influxdata:master Jun 29, 2016
@nathanielc
Copy link
Contributor

@burdandrei Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants