Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
revere: add configurable host into env
Browse files Browse the repository at this point in the history
Allows configuration of the host

R=robfig,eefi
TEST=manual
  • Loading branch information
atien-yext committed Dec 20, 2018
1 parent 73d4abe commit 74d77dc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions daemon/subprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func (s *subprobe) newAlert(oldState state.State, r probe.Reading) *target.Alert
LastNormal: s.lastNormal,

Details: r.Details,
Host: s.Env.Host,
}
}

Expand Down
3 changes: 3 additions & 0 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
type Env struct {
DB *db.DB
Port uint16
Host string
}

// New initializes an Env based on the configuration found in conf, which
Expand All @@ -41,6 +42,7 @@ func New(conf []byte) (*Env, error) {
return nil, errors.Maskf(err, "load DB")
}
e.Port = model.Port
e.Host = model.Host

return &e, nil
}
Expand All @@ -50,4 +52,5 @@ func New(conf []byte) (*Env, error) {
type EnvJSONModel struct {
DB db.DBJSONModel
Port uint16
Host string
}
2 changes: 2 additions & 0 deletions target/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ type Alert struct {
LastNormal time.Time

Details probe.Details

Host string
}
3 changes: 1 addition & 2 deletions target/emailtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ func (_ emailType) Alert(Db *db.DB, a *Alert, toAlert map[db.TriggerID]Target, i
return nil
}

// TODO(eefi): Update Revere link.
const emailText = `
{{.NewState}} is the state of {{.MonitorName}}/{{.SubprobeName}} as of {{time .Recorded}}.
http://revere.khan/monitors/{{.MonitorID}}/subprobes/{{.SubprobeID}}
{{.Host}}/monitors/{{.MonitorID}}/subprobes/{{.SubprobeID}}
{{if ne .OldState .NewState -}}
State change: {{.OldState}}->{{.NewState}}
Expand Down
4 changes: 2 additions & 2 deletions target/slacknotifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func (s slackNotifier) formatMessage(channel string) (io.Reader, error) {
Attachments: []attachment{
{
Title: fmt.Sprintf("%s/%s", s.alert.MonitorName, s.alert.SubprobeName),
TitleLink: fmt.Sprintf("http://revere.khan/monitors/%d/subprobes/%d",
s.alert.MonitorID, s.alert.SubprobeID),
TitleLink: fmt.Sprintf("%s/monitors/%d/subprobes/%d",
s.alert.Host, s.alert.MonitorID, s.alert.SubprobeID),
Fallback: fmt.Sprintf("%s/%s entered state: %s",
s.alert.MonitorName, s.alert.SubprobeName, s.alert.NewState),
Color: stateColors[s.alert.NewState],
Expand Down

0 comments on commit 74d77dc

Please sign in to comment.