Skip to content

Commit

Permalink
fix pull request #194.
Browse files Browse the repository at this point in the history
  - Replace [jianliao] with [talk].
  - Remove change with Sensu.
  - Remove level parameter.
  - Add a blurb on how to create Talk webhook.
  • Loading branch information
Wu Taizeng committed Feb 3, 2016
1 parent ccb9608 commit cb1dce3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,6 @@ func (a *AlertNode) handleTalk(talk *pipeline.TalkHandler, ad *AlertData) {
err := a.et.tm.TalkService.Alert(
ad.ID,
ad.Message,
ad.Level,
)
if err != nil {
a.logger.Println("E! failed to send alert data to Talk:", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kapacitord/run/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (s *Server) appendReportingService(c reporting.Config) {

func (s *Server) appendTalkService(c talk.Config) {
if c.Enabled {
l := s.LogService.NewLogger("[jiaoliao] ", log.LstdFlags)
l := s.LogService.NewLogger("[talk] ", log.LstdFlags)
srv := talk.NewService(c, l)
s.TaskMaster.TalkService = srv

Expand Down
11 changes: 10 additions & 1 deletion pipeline/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ func (a *AlertNode) Sensu() *SensuHandler {
return sensu
}

// tick:embedded:AlertNode.SensuHandler
// tick:embedded:AlertNode.Sensu
type SensuHandler struct {
*AlertNode
}
Expand Down Expand Up @@ -837,6 +837,15 @@ func (og *OpsGenieHandler) Recipients(recipients ...string) *OpsGenieHandler {
}

// Send the alert to Talk.
// To use Talk alerting you must first follow the steps to create a new incoming webhook.
//
// 1. Go to the URL https:/account.jianliao.com/signin.
// 2. Sign in with you account. under the Team tab, click "Integrations".
// 3. Select "Customize service", click incoming Webhook "Add" button.
// 4. After choose the topic to connect with "xxx", click "Confirm Add" button.
// 5. Once the service is created, you'll see the "Generate Webhook url".
//
// Place the 'Generate Webhook url' into the 'Talk' section of the Kapacitor configuration as the option 'url'.
//
// Example:
// [talk]
Expand Down
4 changes: 1 addition & 3 deletions services/talk/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"errors"
"log"
"net/http"

"github.com/influxdata/kapacitor"
)

type Service struct {
Expand All @@ -32,7 +30,7 @@ func (s *Service) Close() error {
return nil
}

func (s *Service) Alert(title, text string, level kapacitor.AlertLevel) error {
func (s *Service) Alert(title, text string) error {
postData := make(map[string]interface{})
postData["title"] = title
postData["text"] = text
Expand Down
2 changes: 1 addition & 1 deletion task_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type TaskMaster struct {
Alert(name, output string, level AlertLevel) error
}
TalkService interface {
Alert(name, output string, level AlertLevel) error
Alert(title, text string) error
}
LogService LogService

Expand Down

0 comments on commit cb1dce3

Please sign in to comment.