alertmanager

package
v1.3.0-rc.1.0...-65594da Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertStore

type AlertStore interface {
	ListAlertConfigs(ctx context.Context) (map[string]alerts.AlertConfigDesc, error)
	GetAlertConfig(ctx context.Context, user string) (alerts.AlertConfigDesc, error)
	SetAlertConfig(ctx context.Context, cfg alerts.AlertConfigDesc) error
	DeleteAlertConfig(ctx context.Context, user string) error
}

AlertStore stores and configures users rule configs

func NewAlertStore

func NewAlertStore(cfg AlertStoreConfig) (AlertStore, error)

NewAlertStore returns a new rule storage backend poller and store

type AlertStoreConfig

type AlertStoreConfig struct {
	Type     string            `yaml:"type"`
	ConfigDB client.Config     `yaml:"configdb"`
	Local    local.StoreConfig `yaml:"local"`

	GCS gcp.GCSConfig `yaml:"gcs"`
	S3  aws.S3Config  `yaml:"s3"`
}

AlertStoreConfig configures the alertmanager backend

func (*AlertStoreConfig) RegisterFlags

func (cfg *AlertStoreConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

type Alertmanager

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

An Alertmanager manages the alerts for one user.

func New

func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error)

New creates a new Alertmanager.

func (*Alertmanager) ApplyConfig

func (am *Alertmanager) ApplyConfig(userID string, conf *config.Config) error

ApplyConfig applies a new configuration to an Alertmanager.

func (*Alertmanager) IsActive

func (am *Alertmanager) IsActive() bool

IsActive returns if the alertmanager is currently running or is paused

func (*Alertmanager) Pause

func (am *Alertmanager) Pause()

Pause running jobs in the alertmanager that are able to be restarted and sets to inactives

func (*Alertmanager) Stop

func (am *Alertmanager) Stop()

Stop stops the Alertmanager.

type Config

type Config struct {
	UserID string
	// Used to persist notification logs and silences on disk.
	DataDir     string
	Logger      log.Logger
	Peer        *cluster.Peer
	PeerTimeout time.Duration
	Retention   time.Duration
	ExternalURL *url.URL
}

Config configures an Alertmanager.

type MultitenantAlertmanager

type MultitenantAlertmanager struct {
	services.Service
	// contains filtered or unexported fields
}

A MultitenantAlertmanager manages Alertmanager instances for multiple organizations.

func NewMultitenantAlertmanager

func NewMultitenantAlertmanager(cfg *MultitenantAlertmanagerConfig, logger log.Logger, registerer prometheus.Registerer) (*MultitenantAlertmanager, error)

NewMultitenantAlertmanager creates a new MultitenantAlertmanager.

func (*MultitenantAlertmanager) DeleteUserConfig

func (am *MultitenantAlertmanager) DeleteUserConfig(w http.ResponseWriter, r *http.Request)

func (*MultitenantAlertmanager) GetStatusHandler

func (am *MultitenantAlertmanager) GetStatusHandler() StatusHandler

GetStatusHandler returns the status handler for this multi-tenant alertmanager.

func (*MultitenantAlertmanager) GetUserConfig

func (am *MultitenantAlertmanager) GetUserConfig(w http.ResponseWriter, r *http.Request)

func (*MultitenantAlertmanager) ServeHTTP

func (am *MultitenantAlertmanager) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves the Alertmanager's web UI and API.

func (*MultitenantAlertmanager) SetUserConfig

func (am *MultitenantAlertmanager) SetUserConfig(w http.ResponseWriter, r *http.Request)

type MultitenantAlertmanagerConfig

type MultitenantAlertmanagerConfig struct {
	DataDir      string           `yaml:"data_dir"`
	Retention    time.Duration    `yaml:"retention"`
	ExternalURL  flagext.URLValue `yaml:"external_url"`
	PollInterval time.Duration    `yaml:"poll_interval"`

	ClusterBindAddr      string              `yaml:"cluster_bind_address"`
	ClusterAdvertiseAddr string              `yaml:"cluster_advertise_address"`
	Peers                flagext.StringSlice `yaml:"peers"`
	PeerTimeout          time.Duration       `yaml:"peer_timeout"`

	FallbackConfigFile string `yaml:"fallback_config_file"`
	AutoWebhookRoot    string `yaml:"auto_webhook_root"`

	Store AlertStoreConfig `yaml:"storage"`

	EnableAPI bool `yaml:"enable_api"`
}

MultitenantAlertmanagerConfig is the configuration for a multitenant Alertmanager.

func (*MultitenantAlertmanagerConfig) RegisterFlags

func (cfg *MultitenantAlertmanagerConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

type StatusHandler

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

StatusHandler shows the status of the alertmanager.

func (StatusHandler) ServeHTTP

func (s StatusHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves the status of the alertmanager.

type UserConfig

type UserConfig struct {
	TemplateFiles      map[string]string `yaml:"template_files"`
	AlertmanagerConfig string            `yaml:"alertmanager_config"`
}

UserConfig is used to communicate a users alertmanager configs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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