notifier

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2016 License: GPL-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package notifier manages notifications for consul-alerts

Package notifier manages notifications for consul-alerts

Index

Constants

View Source
const (
	SYSTEM_HEALTHY  string = "HEALTHY"
	SYSTEM_UNSTABLE string = "UNSTABLE"
	SYSTEM_CRITICAL string = "CRITICAL"
)

Variables

This section is empty.

Functions

func MakeBody added in v0.4.0

func MakeBody(messages Messages) string

func MakeSubject added in v0.4.0

func MakeSubject(messages Messages) string

Types

type AwsSnsNotifier added in v0.4.0

type AwsSnsNotifier struct {
	Region    string
	TopicArn  string
	NotifName string
}

func (*AwsSnsNotifier) NotifierName added in v0.4.0

func (awssns *AwsSnsNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*AwsSnsNotifier) Notify added in v0.4.0

func (awssns *AwsSnsNotifier) Notify(messages Messages) bool

func (*AwsSnsNotifier) Send added in v0.4.0

func (awssns *AwsSnsNotifier) Send(subject string, message string) bool

type EmailData

type EmailData struct {
	ClusterName  string
	SystemStatus string
	FailCount    int
	WarnCount    int
	PassCount    int
	Nodes        map[string]Messages
}

func (EmailData) IsCritical

func (e EmailData) IsCritical() bool

func (EmailData) IsPassing

func (e EmailData) IsPassing() bool

func (EmailData) IsWarning

func (e EmailData) IsWarning() bool

type EmailNotifier

type EmailNotifier struct {
	ClusterName string
	Template    string
	Url         string
	Port        int
	Username    string
	Password    string
	SenderAlias string
	SenderEmail string
	Receivers   []string
	NotifName   string
	OnePerAlert bool
	OnePerNode  bool
}

func (*EmailNotifier) NotifierName added in v0.4.0

func (emailNotifier *EmailNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*EmailNotifier) Notify

func (emailNotifier *EmailNotifier) Notify(alerts Messages) bool

Notify sends messages to the endpoint notifier

type HipChatNotifier added in v0.3.1

type HipChatNotifier struct {
	ClusterName string
	RoomId      string
	AuthToken   string
	BaseURL     string
	From        string
	NotifName   string
}

func (*HipChatNotifier) NotifierName added in v0.4.0

func (notifier *HipChatNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*HipChatNotifier) Notify added in v0.3.1

func (notifier *HipChatNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

type InfluxdbNotifier

type InfluxdbNotifier struct {
	Host       string
	Username   string
	Password   string
	Database   string
	SeriesName string
	NotifName  string
}

func (*InfluxdbNotifier) NotifierName added in v0.4.0

func (influxdb *InfluxdbNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*InfluxdbNotifier) Notify

func (influxdb *InfluxdbNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

type LogNotifier

type LogNotifier struct {
	LogFile   string
	NotifName string
}

func (*LogNotifier) NotifierName added in v0.4.0

func (logNotifier *LogNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*LogNotifier) Notify

func (logNotifier *LogNotifier) Notify(alerts Messages) bool

Notify sends messages to the endpoint notifier

type Message

type Message struct {
	Node      string
	ServiceId string
	Service   string
	CheckId   string
	Check     string
	Status    string
	Output    string
	Notes     string
	Interval  int
	RmdCheck  time.Time
	NotifList map[string]bool
	Timestamp time.Time
}

func (Message) IsCritical

func (m Message) IsCritical() bool

func (Message) IsPassing

func (m Message) IsPassing() bool

func (Message) IsWarning

func (m Message) IsWarning() bool

type Messages

type Messages []Message

func (Messages) Summary

func (m Messages) Summary() (overallStatus string, pass, warn, fail int)

type Notifier

type Notifier interface {
	Notify(alerts Messages) bool
	NotifierName() string
}

type OpsGenieNotifier added in v0.3.3

type OpsGenieNotifier struct {
	ClusterName string
	ApiKey      string
	NotifName   string
}

func (*OpsGenieNotifier) NotifierName added in v0.4.0

func (opsgenie *OpsGenieNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*OpsGenieNotifier) Notify added in v0.3.3

func (opsgenie *OpsGenieNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

type PagerDutyNotifier added in v0.1.2

type PagerDutyNotifier struct {
	ServiceKey string
	ClientName string
	ClientUrl  string
	NotifName  string
}

func (*PagerDutyNotifier) NotifierName added in v0.4.0

func (pd *PagerDutyNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*PagerDutyNotifier) Notify added in v0.1.2

func (pd *PagerDutyNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

type SlackNotifier

type SlackNotifier struct {
	ClusterName string       `json:"-"`
	Url         string       `json:"-"`
	Channel     string       `json:"channel"`
	Username    string       `json:"username"`
	IconUrl     string       `json:"icon_url"`
	IconEmoji   string       `json:"icon_emoji"`
	Text        string       `json:"text,omitempty"`
	Attachments []attachment `json:"attachments,omitempty"`
	Detailed    bool         `json:"-"`
	NotifName   string
}

func (*SlackNotifier) NotifierName added in v0.4.0

func (slack *SlackNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*SlackNotifier) Notify

func (slack *SlackNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

type VictorOpsEvent added in v0.4.0

type VictorOpsEvent struct {
	// Explicitly listed by http://victorops.force.com/knowledgebase/articles/Integration/Alert-Ingestion-API-Documentation/
	MessageType       string `json:"message_type"`
	EntityID          string `json:"entity_id"`
	Timestamp         uint32 `json:"timestamp"`
	StateMessage      string `json:"state_message"`
	MonitoringTool    string `json:"monitoring_tool"`
	EntityDisplayName string `json:"entity_display_name"`

	// Helpful fields from http://victorops.force.com/knowledgebase/articles/Getting_Started/Incident-Fields-Glossary/?l=en_US&fs=RelatedArticle
	HostName    string `json:"host_name"`
	MonitorName string `json:"monitor_name"`

	// VictorOps lets you add arbitrary fields to help custom notification logic, so we'll set
	// node, service, service ID, check, and check ID
	ConsulNode      string `json:"consul_node"`
	ConsulService   string `json:"consul_service,omitempty"`
	ConsulServiceID string `json:"consul_service_id,omitempty"`
	ConsulCheck     string `json:"consul_check"`
	ConsulCheckID   string `json:"consul_check_id"`
}

VictorOpsEvent represents the options we'll pass to the VictorOps API

type VictorOpsNotifier added in v0.4.0

type VictorOpsNotifier struct {
	NotifName  string
	APIKey     string
	RoutingKey string
}

VictorOpsNotifier provides configuration options for the VictorOps notifier

func (*VictorOpsNotifier) NotifierName added in v0.4.0

func (vo *VictorOpsNotifier) NotifierName() string

NotifierName provides name for notifier selection

func (*VictorOpsNotifier) Notify added in v0.4.0

func (vo *VictorOpsNotifier) Notify(messages Messages) bool

Notify sends messages to the endpoint notifier

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL