Documentation ¶
Index ¶
Constants ¶
const CirconusTimeFormat = "Mon, 02 Jan 2006 15:04:05"
CirconusTimeFormat represents the datetime format Circonus sends times in the webhook payload
Variables ¶
var CirconusAccountTimezone = time.Local
CirconusAccountTimezone represents the timezone the account is in since the webhook payload lacks this information. Exposed globally so it can be overridden.
Functions ¶
This section is empty.
Types ¶
type CirconusAlert ¶
type CirconusAlert struct { ID int `json:"alert_id"` Severity int `json:"severity"` Value CirconusAlertValue `json:"alert_value"` Time CirconusTime `json:"alert_time"` URL string `json:"alert_url"` Agent string `json:"agent"` CheckName string `json:"check_name"` MetricName string `json:"metric_name"` ClearTime CirconusTime `json:"clear_time"` ClearValue CirconusAlertValue `json:"clear_value"` }
CirconusAlert represents an alert in the JSON payload sent via Circonus webhook
func (*CirconusAlert) IsRecovery ¶
func (a *CirconusAlert) IsRecovery() bool
IsRecovery returns whether the alert represents a recovery rather than an alert
type CirconusAlertValue ¶
type CirconusAlertValue struct {
// contains filtered or unexported fields
}
CirconusAlertValue represents the value of an alert in Circonus Circonus will encode string or a numeric value in the JSON payload, but we will just consider it a string to be safe.
func (*CirconusAlertValue) String ¶
func (cav *CirconusAlertValue) String() string
String returns the underlying string value
func (*CirconusAlertValue) UnmarshalJSON ¶
func (cav *CirconusAlertValue) UnmarshalJSON(body []byte) (err error)
UnmarshalJSON interprets the value as a string regardless of whether it is a numeric value or not
type CirconusPayload ¶
type CirconusPayload struct { AccountName string `json:"account_name"` Alerts []*CirconusAlert `json:"alerts"` }
CirconusPayload represents the JSON payload sent via Circonus webhook
type CirconusTime ¶
CirconusTime represents a time in the Circonus webhook payload This is needed to parse the format Circonus sends times in
func (*CirconusTime) UnmarshalJSON ¶
func (ct *CirconusTime) UnmarshalJSON(body []byte) (err error)
UnmarshalJSON parse the time in the format expected from Circonus in the timezone specified globally
type Handler ¶
Handler is the interface that webhook proxies should implement so that they can be hooked into the server
type HipchatHandler ¶
type HipchatHandler struct { HipchatClient *hipchat.Client AlertTemplate *template.Template RecoveryTemplate *template.Template AlertColor string RecoveryColor string From string }
HipchatHandler handles webhook requests by forwarding them to the Hipchat API
func NewHipchatHandler ¶
func NewHipchatHandler() *HipchatHandler
NewHipchatHandler creates a new by reading the environment
func (*HipchatHandler) Name ¶
func (hh *HipchatHandler) Name() string
Name returns the name of the handler
func (*HipchatHandler) Register ¶
func (hh *HipchatHandler) Register(r *mux.Router)
Register adds the Hipchat handler to the router
func (*HipchatHandler) Route ¶
func (hh *HipchatHandler) Route() string
Route returns the route to mount the handler at
func (*HipchatHandler) ServeHTTP ¶
func (hh *HipchatHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP parses Circonus webhook payload and sends messages to Hipchat
func (*HipchatHandler) Usage ¶
func (hh *HipchatHandler) Usage() string
Usage returns a string to show to the user about configuration of this hook