client

package
v0.15.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Labels       LabelSet  `json:"labels"`
	Annotations  LabelSet  `json:"annotations"`
	StartsAt     time.Time `json:"startsAt,omitempty"`
	EndsAt       time.Time `json:"endsAt,omitempty"`
	GeneratorURL string    `json:"generatorURL"`
}

Alert represents an alert as expected by the AlertManager's push alert API.

type AlertAPI

type AlertAPI interface {
	// List returns all the active alerts.
	List(ctx context.Context, filter, receiver string, silenced, inhibited, active, unprocessed bool) ([]*ExtendedAlert, error)
	// Push sends a list of alerts to the Alertmanager.
	Push(ctx context.Context, alerts ...Alert) error
}

AlertAPI provides bindings for the Alertmanager's alert API.

func NewAlertAPI

func NewAlertAPI(c api.Client) AlertAPI

NewAlertAPI returns a new AlertAPI for the client.

type ClusterStatus

type ClusterStatus struct {
	Name   string       `json:"name"`
	Status string       `json:"status"`
	Peers  []PeerStatus `json:"peers"`
}

ClusterStatus represents the status of the cluster.

type ExtendedAlert

type ExtendedAlert struct {
	Alert
	Status      types.AlertStatus `json:"status"`
	Receivers   []string          `json:"receivers"`
	Fingerprint string            `json:"fingerprint"`
}

ExtendedAlert represents an alert as returned by the AlertManager's list alert API.

type LabelName

type LabelName string

LabelName represents the name of a label.

type LabelSet

type LabelSet map[LabelName]LabelValue

LabelSet represents a collection of label names and values as a map.

type LabelValue

type LabelValue string

LabelValue represents the value of a label.

type PeerStatus

type PeerStatus struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

PeerStatus represents the status of a peer in the cluster.

type ServerStatus

type ServerStatus struct {
	ConfigYAML    string            `json:"configYAML"`
	ConfigJSON    *config.Config    `json:"configJSON"`
	VersionInfo   map[string]string `json:"versionInfo"`
	Uptime        time.Time         `json:"uptime"`
	ClusterStatus *ClusterStatus    `json:"clusterStatus"`
}

ServerStatus represents the status of the AlertManager endpoint.

type SilenceAPI

type SilenceAPI interface {
	// Get returns the silence associated with the given ID.
	Get(ctx context.Context, id string) (*types.Silence, error)
	// Set updates or creates the given silence and returns its ID.
	Set(ctx context.Context, sil types.Silence) (string, error)
	// Expire expires the silence with the given ID.
	Expire(ctx context.Context, id string) error
	// List returns silences matching the given filter.
	List(ctx context.Context, filter string) ([]*types.Silence, error)
}

SilenceAPI provides bindings for the Alertmanager's silence API.

func NewSilenceAPI

func NewSilenceAPI(c api.Client) SilenceAPI

NewSilenceAPI returns a new SilenceAPI for the client.

type StatusAPI

type StatusAPI interface {
	// Get returns the server's configuration, version, uptime and cluster information.
	Get(ctx context.Context) (*ServerStatus, error)
}

StatusAPI provides bindings for the Alertmanager's status API.

func NewStatusAPI

func NewStatusAPI(c api.Client) StatusAPI

NewStatusAPI returns a status API client.

Jump to

Keyboard shortcuts

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