Documentation ¶
Index ¶
- type Alertmanager
- func (am *Alertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error
- func (am *Alertmanager) CompareAndSendConfiguration(ctx context.Context, config *models.AlertConfiguration) error
- func (am *Alertmanager) CompareAndSendState(ctx context.Context) error
- func (am *Alertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)
- func (am *Alertmanager) DeleteSilence(ctx context.Context, silenceID string) error
- func (am *Alertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.AlertGroups, error)
- func (am *Alertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.GettableAlerts, error)
- func (am *Alertmanager) GetReceivers(ctx context.Context) ([]apimodels.Receiver, error)
- func (am *Alertmanager) GetSilence(ctx context.Context, silenceID string) (apimodels.GettableSilence, error)
- func (am *Alertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)
- func (am *Alertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)
- func (am *Alertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error
- func (am *Alertmanager) Ready() bool
- func (am *Alertmanager) SaveAndApplyConfig(ctx context.Context, cfg *apimodels.PostableUserConfig) error
- func (am *Alertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error
- func (am *Alertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)
- func (am *Alertmanager) StopAndWait()
- func (am *Alertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
- func (am *Alertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
- type AlertmanagerConfig
- type DecryptFn
- type RemotePrimaryForkedAlertmanager
- func (fam *RemotePrimaryForkedAlertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error
- func (fam *RemotePrimaryForkedAlertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)
- func (fam *RemotePrimaryForkedAlertmanager) DeleteSilence(ctx context.Context, id string) error
- func (fam *RemotePrimaryForkedAlertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.AlertGroups, error)
- func (fam *RemotePrimaryForkedAlertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.GettableAlerts, error)
- func (fam *RemotePrimaryForkedAlertmanager) GetReceivers(ctx context.Context) ([]apimodels.Receiver, error)
- func (fam *RemotePrimaryForkedAlertmanager) GetSilence(ctx context.Context, id string) (apimodels.GettableSilence, error)
- func (fam *RemotePrimaryForkedAlertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)
- func (fam *RemotePrimaryForkedAlertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)
- func (fam *RemotePrimaryForkedAlertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error
- func (fam *RemotePrimaryForkedAlertmanager) Ready() bool
- func (fam *RemotePrimaryForkedAlertmanager) SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error
- func (fam *RemotePrimaryForkedAlertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error
- func (fam *RemotePrimaryForkedAlertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)
- func (fam *RemotePrimaryForkedAlertmanager) StopAndWait()
- func (fam *RemotePrimaryForkedAlertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
- func (fam *RemotePrimaryForkedAlertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
- type RemoteSecondaryConfig
- type RemoteSecondaryForkedAlertmanager
- func (fam *RemoteSecondaryForkedAlertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error
- func (fam *RemoteSecondaryForkedAlertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)
- func (fam *RemoteSecondaryForkedAlertmanager) DeleteSilence(ctx context.Context, id string) error
- func (fam *RemoteSecondaryForkedAlertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.AlertGroups, error)
- func (fam *RemoteSecondaryForkedAlertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, ...) (apimodels.GettableAlerts, error)
- func (fam *RemoteSecondaryForkedAlertmanager) GetReceivers(ctx context.Context) ([]apimodels.Receiver, error)
- func (fam *RemoteSecondaryForkedAlertmanager) GetSilence(ctx context.Context, id string) (apimodels.GettableSilence, error)
- func (fam *RemoteSecondaryForkedAlertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)
- func (fam *RemoteSecondaryForkedAlertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)
- func (fam *RemoteSecondaryForkedAlertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error
- func (fam *RemoteSecondaryForkedAlertmanager) Ready() bool
- func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error
- func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error
- func (fam *RemoteSecondaryForkedAlertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)
- func (fam *RemoteSecondaryForkedAlertmanager) StopAndWait()
- func (fam *RemoteSecondaryForkedAlertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
- func (fam *RemoteSecondaryForkedAlertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
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 (*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.
func (*Alertmanager) TestReceivers ¶
func (am *Alertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
func (*Alertmanager) TestTemplate ¶
func (am *Alertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
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 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 ¶
func (fam *RemotePrimaryForkedAlertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error
ApplyConfig will send the configuration to the remote Alertmanager on startup.
func (*RemotePrimaryForkedAlertmanager) CreateSilence ¶
func (fam *RemotePrimaryForkedAlertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)
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 (fam *RemotePrimaryForkedAlertmanager) GetSilence(ctx context.Context, id string) (apimodels.GettableSilence, error)
func (*RemotePrimaryForkedAlertmanager) GetStatus ¶
func (fam *RemotePrimaryForkedAlertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)
func (*RemotePrimaryForkedAlertmanager) ListSilences ¶
func (fam *RemotePrimaryForkedAlertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)
func (*RemotePrimaryForkedAlertmanager) PutAlerts ¶
func (fam *RemotePrimaryForkedAlertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error
func (*RemotePrimaryForkedAlertmanager) Ready ¶
func (fam *RemotePrimaryForkedAlertmanager) Ready() bool
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 (fam *RemotePrimaryForkedAlertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)
func (*RemotePrimaryForkedAlertmanager) StopAndWait ¶
func (fam *RemotePrimaryForkedAlertmanager) StopAndWait()
func (*RemotePrimaryForkedAlertmanager) TestReceivers ¶
func (fam *RemotePrimaryForkedAlertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
func (*RemotePrimaryForkedAlertmanager) TestTemplate ¶
func (fam *RemotePrimaryForkedAlertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
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 ¶
func (fam *RemoteSecondaryForkedAlertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error
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 (fam *RemoteSecondaryForkedAlertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error)
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 (fam *RemoteSecondaryForkedAlertmanager) GetSilence(ctx context.Context, id string) (apimodels.GettableSilence, error)
func (*RemoteSecondaryForkedAlertmanager) GetStatus ¶
func (fam *RemoteSecondaryForkedAlertmanager) GetStatus(ctx context.Context) (apimodels.GettableStatus, error)
func (*RemoteSecondaryForkedAlertmanager) ListSilences ¶
func (fam *RemoteSecondaryForkedAlertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error)
func (*RemoteSecondaryForkedAlertmanager) PutAlerts ¶
func (fam *RemoteSecondaryForkedAlertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error
func (*RemoteSecondaryForkedAlertmanager) Ready ¶
func (fam *RemoteSecondaryForkedAlertmanager) Ready() bool
func (*RemoteSecondaryForkedAlertmanager) SaveAndApplyConfig ¶
func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error
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 (fam *RemoteSecondaryForkedAlertmanager) SilenceState(ctx context.Context) (alertingNotify.SilenceState, error)
func (*RemoteSecondaryForkedAlertmanager) StopAndWait ¶
func (fam *RemoteSecondaryForkedAlertmanager) StopAndWait()
func (*RemoteSecondaryForkedAlertmanager) TestReceivers ¶
func (fam *RemoteSecondaryForkedAlertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
func (*RemoteSecondaryForkedAlertmanager) TestTemplate ¶
func (fam *RemoteSecondaryForkedAlertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)