consul

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: GPL-2.0 Imports: 9 Imported by: 31

Documentation

Index

Constants

View Source
const (
	ConfigTypeBool = iota
	ConfigTypeString
	ConfigTypeInt
	ConfigTypeStrArray
	ConfigTypeStrMap
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Node        string
	CheckID     string
	Name        string
	Status      string
	Notes       string
	Output      string
	ServiceID   string
	ServiceName string
}

type ChecksConfig

type ChecksConfig struct {
	Enabled         bool
	ChangeThreshold int
}

type Consul

type Consul interface {
	LoadConfig()

	EventsEnabled() bool
	ChecksEnabled() bool
	EventHandlers(eventName string) []string

	EmailNotifier() *notifier.EmailNotifier
	LogNotifier() *notifier.LogNotifier
	InfluxdbNotifier() *notifier.InfluxdbNotifier
	SlackNotifier() *notifier.SlackNotifier
	MattermostNotifier() *notifier.MattermostNotifier
	MattermostWebhookNotifier() *notifier.MattermostWebhookNotifier
	PagerDutyNotifier() *notifier.PagerDutyNotifier
	HipChatNotifier() *notifier.HipChatNotifier
	OpsGenieNotifier() *notifier.OpsGenieNotifier
	AwsSnsNotifier() *notifier.AwsSnsNotifier
	VictorOpsNotifier() *notifier.VictorOpsNotifier
	HttpEndpointNotifier() *notifier.HttpEndpointNotifier
	ILertNotifier() *notifier.ILertNotifier

	CheckChangeThreshold() int
	UpdateCheckData()
	NewAlerts() []Check
	NewAlertsWithFilter(node string, service string, checkId string, statuses []string, ignoreBlacklist bool) []Check

	IsBlacklisted(check *Check) bool

	CustomNotifiers() map[string]string

	CheckStatus(node, statusId, checkId string) (status, output string)
	CheckKeyExists(key string) bool

	GetProfileInfo(node, serviceID, checkID, status string) ProfileInfo

	GetReminders() []notifier.Message
	SetReminder(m notifier.Message)
	DeleteReminder(node string, checkid string)
}

Consul interface provides access to consul client

type ConsulAlertClient

type ConsulAlertClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(address, dc, aclToken string) (*ConsulAlertClient, error)

func (*ConsulAlertClient) AwsSnsNotifier added in v0.5.0

func (c *ConsulAlertClient) AwsSnsNotifier() *notifier.AwsSnsNotifier

func (*ConsulAlertClient) CheckChangeThreshold

func (c *ConsulAlertClient) CheckChangeThreshold() int

func (*ConsulAlertClient) CheckKeyExists added in v0.3.2

func (c *ConsulAlertClient) CheckKeyExists(key string) bool

func (*ConsulAlertClient) CheckKeyMatchesRegexp added in v0.5.0

func (c *ConsulAlertClient) CheckKeyMatchesRegexp(regexpKey string, key string) bool

func (*ConsulAlertClient) CheckStatus

func (c *ConsulAlertClient) CheckStatus(node, serviceId, checkId string) (status, output string)

func (*ConsulAlertClient) ChecksEnabled

func (c *ConsulAlertClient) ChecksEnabled() bool

func (*ConsulAlertClient) CustomNotifiers

func (c *ConsulAlertClient) CustomNotifiers() (customNotifs map[string]string)

CustomNotifiers returns a map of all custom notifiers and command path as the key value

func (*ConsulAlertClient) DeleteReminder added in v0.4.0

func (c *ConsulAlertClient) DeleteReminder(node string, checkid string)

DeleteReminder deletes a reminder

func (*ConsulAlertClient) EmailNotifier added in v0.5.0

func (c *ConsulAlertClient) EmailNotifier() *notifier.EmailNotifier

func (*ConsulAlertClient) EventHandlers

func (c *ConsulAlertClient) EventHandlers(eventName string) []string

func (*ConsulAlertClient) EventsEnabled

func (c *ConsulAlertClient) EventsEnabled() bool

func (*ConsulAlertClient) GetChangeThreshold added in v0.5.0

func (c *ConsulAlertClient) GetChangeThreshold(check *Check) int

GetChangeThreshold gets the node/service/check specific override for change threshold

func (*ConsulAlertClient) GetProfileInfo added in v0.4.0

func (c *ConsulAlertClient) GetProfileInfo(node, serviceID, checkID, status string) ProfileInfo

GetProfileInfo returns profile info for check

func (*ConsulAlertClient) GetReminders added in v0.4.0

func (c *ConsulAlertClient) GetReminders() []notifier.Message

GetReminders returns list of reminders

func (*ConsulAlertClient) HipChatNotifier added in v0.5.0

func (c *ConsulAlertClient) HipChatNotifier() *notifier.HipChatNotifier

func (*ConsulAlertClient) HttpEndpointNotifier added in v0.6.0

func (c *ConsulAlertClient) HttpEndpointNotifier() *notifier.HttpEndpointNotifier

func (*ConsulAlertClient) ILertNotifier added in v0.6.0

func (c *ConsulAlertClient) ILertNotifier() *notifier.ILertNotifier

func (*ConsulAlertClient) InfluxdbNotifier added in v0.5.0

func (c *ConsulAlertClient) InfluxdbNotifier() *notifier.InfluxdbNotifier

func (*ConsulAlertClient) IsBlacklisted added in v0.1.2

func (c *ConsulAlertClient) IsBlacklisted(check *Check) bool

IsBlacklisted gets the blacklist status of check

func (*ConsulAlertClient) LoadConfig

func (c *ConsulAlertClient) LoadConfig()

func (*ConsulAlertClient) LogNotifier added in v0.5.0

func (c *ConsulAlertClient) LogNotifier() *notifier.LogNotifier

func (*ConsulAlertClient) MattermostNotifier added in v0.5.0

func (c *ConsulAlertClient) MattermostNotifier() *notifier.MattermostNotifier

func (*ConsulAlertClient) MattermostWebhookNotifier added in v0.6.0

func (c *ConsulAlertClient) MattermostWebhookNotifier() *notifier.MattermostWebhookNotifier

func (*ConsulAlertClient) NewAlerts

func (c *ConsulAlertClient) NewAlerts() []Check

NewAlerts returns a list of checks marked for notification

func (*ConsulAlertClient) NewAlertsWithFilter added in v0.4.0

func (c *ConsulAlertClient) NewAlertsWithFilter(nodeName string, serviceName string, checkName string, statuses []string, ignoreBlacklist bool) []Check

func (*ConsulAlertClient) OpsGenieNotifier added in v0.5.0

func (c *ConsulAlertClient) OpsGenieNotifier() *notifier.OpsGenieNotifier

func (*ConsulAlertClient) PagerDutyNotifier added in v0.5.0

func (c *ConsulAlertClient) PagerDutyNotifier() *notifier.PagerDutyNotifier

func (*ConsulAlertClient) SetReminder added in v0.4.0

func (c *ConsulAlertClient) SetReminder(m notifier.Message)

SetReminder sets a reminder

func (*ConsulAlertClient) SlackNotifier added in v0.5.0

func (c *ConsulAlertClient) SlackNotifier() *notifier.SlackNotifier

func (*ConsulAlertClient) UpdateCheckData

func (c *ConsulAlertClient) UpdateCheckData()

func (*ConsulAlertClient) VictorOpsNotifier added in v0.5.0

func (c *ConsulAlertClient) VictorOpsNotifier() *notifier.VictorOpsNotifier

type ConsulAlertConfig

type ConsulAlertConfig struct {
	Checks    *ChecksConfig
	Events    *EventsConfig
	Notifiers *notifier.Notifiers
}

func DefaultAlertConfig

func DefaultAlertConfig() *ConsulAlertConfig

DefaultAlertConfig loads default config settings

type Event

type Event struct {
	ID            string
	Name          string
	Payload       []byte
	NodeFilter    string
	ServiceFilter string
	TagFilter     string
	Version       uint
	LTime         uint
}

Event data from consul

type EventsConfig

type EventsConfig struct {
	Enabled  bool
	Handlers []string
}

type ProfileInfo added in v0.4.0

type ProfileInfo struct {
	Interval     int
	NotifList    map[string]bool
	VarOverrides notifier.Notifiers
}

ProfileInfo is for reading in JSON from profile keys

type Status

type Status struct {
	Current          string
	CurrentTimestamp time.Time
	Pending          string
	PendingTimestamp time.Time
	HealthCheck      *Check
	ForNotification  bool
}

Jump to

Keyboard shortcuts

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