remote

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alertmanager

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

func NewAlertmanager

func NewAlertmanager(cfg AlertmanagerConfig, store stateStore, decryptFn DecryptFn, metrics *metrics.RemoteAlertmanager) (*Alertmanager, error)

func (*Alertmanager) ApplyConfig

func (am *Alertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error

ApplyConfig is called everytime we've determined we need to apply an existing configuration to the Alertmanager, including the first time the Alertmanager is started. In the context of a "remote Alertmanager" it's as good of a heuristic, for "a function that gets called when the Alertmanager starts". As a result we do two things: 1. Execute a readiness check to make sure the remote Alertmanager we're about to communicate with is up and ready. 2. Upload the configuration and state we currently hold.

func (*Alertmanager) CompareAndSendConfiguration

func (am *Alertmanager) CompareAndSendConfiguration(ctx context.Context, config *models.AlertConfiguration) error

CompareAndSendConfiguration checks whether a given configuration is being used by the remote Alertmanager. If not, it sends the configuration to the remote Alertmanager.

func (*Alertmanager) CompareAndSendState

func (am *Alertmanager) CompareAndSendState(ctx context.Context) error

CompareAndSendState gets the Alertmanager's internal state and compares it with the remote Alertmanager's one. If the states are different, it updates the remote Alertmanager's state with that of the internal Alertmanager.

func (*Alertmanager) CreateSilence

func (am *Alertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)

func (*Alertmanager) DeleteSilence

func (am *Alertmanager) DeleteSilence(ctx context.Context, silenceID string) error

func (*Alertmanager) GetAlertGroups

func (am *Alertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.AlertGroups, error)

func (*Alertmanager) GetAlerts

func (am *Alertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.GettableAlerts, error)

func (*Alertmanager) GetReceivers

func (am *Alertmanager) GetReceivers(ctx context.Context) ([]apimodels.Receiver, error)

func (*Alertmanager) GetSilence

func (am *Alertmanager) GetSilence(ctx context.Context, silenceID string) (apimodels.GettableSilence, error)

func (*Alertmanager) GetStatus

func (am *Alertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)

GetStatus retrieves the remote Alertmanager configuration.

func (*Alertmanager) ListSilences

func (am *Alertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)

func (*Alertmanager) PutAlerts

func (am *Alertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error

func (*Alertmanager) Ready

func (am *Alertmanager) Ready() bool

func (*Alertmanager) SaveAndApplyConfig

func (am *Alertmanager) SaveAndApplyConfig(ctx context.Context, cfg *apimodels.PostableUserConfig) error

SaveAndApplyConfig decrypts and sends a configuration to the remote Alertmanager.

func (*Alertmanager) SaveAndApplyDefaultConfig

func (am *Alertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error

SaveAndApplyDefaultConfig sends the default Grafana Alertmanager configuration to the remote Alertmanager.

func (*Alertmanager) SilenceState

func (am *Alertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)

SilenceState returns the Alertmanager's silence state as a SilenceState. Currently, does not retrieve the state remotely and instead uses the value from the state store.

func (*Alertmanager) StopAndWait

func (am *Alertmanager) StopAndWait()

StopAndWait is called when the grafana server is instructed to shut down or an org is deleted. In the context of a "remote Alertmanager" it is a good heuristic for Grafana is about to shut down or we no longer need you.

type AlertmanagerConfig

type AlertmanagerConfig struct {
	OrgID             int64
	URL               string
	TenantID          string
	BasicAuthPassword string

	DefaultConfig string
	// PromoteConfig is a flag that determines whether the configuration should be used in the remote Alertmanager.
	// The same flag is used for promoting state.
	PromoteConfig bool
}

func (*AlertmanagerConfig) Validate

func (cfg *AlertmanagerConfig) Validate() error

type DecryptFn

type DecryptFn func(ctx context.Context, payload []byte) ([]byte, error)

DecryptFn is a function that takes in an encrypted value and returns it decrypted.

type RemotePrimaryForkedAlertmanager

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

func NewRemotePrimaryForkedAlertmanager

func NewRemotePrimaryForkedAlertmanager(log log.Logger, internal notifier.Alertmanager, remote remoteAlertmanager) *RemotePrimaryForkedAlertmanager

func (*RemotePrimaryForkedAlertmanager) ApplyConfig

ApplyConfig will send the configuration to the remote Alertmanager on startup.

func (*RemotePrimaryForkedAlertmanager) CreateSilence

func (*RemotePrimaryForkedAlertmanager) DeleteSilence

func (fam *RemotePrimaryForkedAlertmanager) DeleteSilence(ctx context.Context, id string) error

func (*RemotePrimaryForkedAlertmanager) GetAlertGroups

func (fam *RemotePrimaryForkedAlertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.AlertGroups, error)

func (*RemotePrimaryForkedAlertmanager) GetAlerts

func (fam *RemotePrimaryForkedAlertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.GettableAlerts, error)

func (*RemotePrimaryForkedAlertmanager) GetReceivers

func (*RemotePrimaryForkedAlertmanager) GetSilence

func (*RemotePrimaryForkedAlertmanager) GetStatus

func (*RemotePrimaryForkedAlertmanager) ListSilences

func (*RemotePrimaryForkedAlertmanager) PutAlerts

func (*RemotePrimaryForkedAlertmanager) Ready

func (*RemotePrimaryForkedAlertmanager) SaveAndApplyConfig

func (fam *RemotePrimaryForkedAlertmanager) SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error

func (*RemotePrimaryForkedAlertmanager) SaveAndApplyDefaultConfig

func (fam *RemotePrimaryForkedAlertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error

func (*RemotePrimaryForkedAlertmanager) SilenceState

func (*RemotePrimaryForkedAlertmanager) StopAndWait

func (fam *RemotePrimaryForkedAlertmanager) StopAndWait()

func (*RemotePrimaryForkedAlertmanager) TestReceivers

func (*RemotePrimaryForkedAlertmanager) TestTemplate

type RemoteSecondaryConfig

type RemoteSecondaryConfig struct {
	Logger log.Logger
	OrgID  int64
	Store  configStore

	// SyncInterval determines how often we should attempt to synchronize
	// state and configuration on the external Alertmanager.
	SyncInterval time.Duration
}

func (*RemoteSecondaryConfig) Validate

func (c *RemoteSecondaryConfig) Validate() error

type RemoteSecondaryForkedAlertmanager

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

func NewRemoteSecondaryForkedAlertmanager

func NewRemoteSecondaryForkedAlertmanager(cfg RemoteSecondaryConfig, internal notifier.Alertmanager, remote remoteAlertmanager) (*RemoteSecondaryForkedAlertmanager, error)

func (*RemoteSecondaryForkedAlertmanager) ApplyConfig

ApplyConfig will only log errors for the remote Alertmanager and ensure we delegate the call to the internal Alertmanager. We don't care about errors in the remote Alertmanager in remote secondary mode.

func (*RemoteSecondaryForkedAlertmanager) CreateSilence

func (*RemoteSecondaryForkedAlertmanager) DeleteSilence

func (fam *RemoteSecondaryForkedAlertmanager) DeleteSilence(ctx context.Context, id string) error

func (*RemoteSecondaryForkedAlertmanager) GetAlertGroups

func (fam *RemoteSecondaryForkedAlertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.AlertGroups, error)

func (*RemoteSecondaryForkedAlertmanager) GetAlerts

func (fam *RemoteSecondaryForkedAlertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.GettableAlerts, error)

func (*RemoteSecondaryForkedAlertmanager) GetReceivers

func (*RemoteSecondaryForkedAlertmanager) GetSilence

func (*RemoteSecondaryForkedAlertmanager) GetStatus

func (*RemoteSecondaryForkedAlertmanager) ListSilences

func (*RemoteSecondaryForkedAlertmanager) PutAlerts

func (*RemoteSecondaryForkedAlertmanager) Ready

func (*RemoteSecondaryForkedAlertmanager) SaveAndApplyConfig

SaveAndApplyConfig is only called on the internal Alertmanager when running in remote secondary mode.

func (*RemoteSecondaryForkedAlertmanager) SaveAndApplyDefaultConfig

func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error

SaveAndApplyDefaultConfig is only called on the internal Alertmanager when running in remote secondary mode.

func (*RemoteSecondaryForkedAlertmanager) SilenceState

func (*RemoteSecondaryForkedAlertmanager) StopAndWait

func (fam *RemoteSecondaryForkedAlertmanager) StopAndWait()

func (*RemoteSecondaryForkedAlertmanager) TestReceivers

func (*RemoteSecondaryForkedAlertmanager) TestTemplate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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