Documentation
¶
Index ¶
- Constants
- Variables
- type AlertStore
- type AlertStoreConfig
- type Alertmanager
- type ClusterConfig
- type Config
- type MultitenantAlertmanager
- func (am *MultitenantAlertmanager) DeleteUserConfig(w http.ResponseWriter, r *http.Request)
- func (am *MultitenantAlertmanager) GetStatusHandler() StatusHandler
- func (am *MultitenantAlertmanager) GetUserConfig(w http.ResponseWriter, r *http.Request)
- func (r *MultitenantAlertmanager) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.IngesterDesc)
- func (r *MultitenantAlertmanager) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, ...) (ring.IngesterState, ring.Tokens)
- func (r *MultitenantAlertmanager) OnRingInstanceStopping(_ *ring.BasicLifecycler)
- func (r *MultitenantAlertmanager) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
- func (am *MultitenantAlertmanager) RingHandler(w http.ResponseWriter, req *http.Request)
- func (am *MultitenantAlertmanager) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (am *MultitenantAlertmanager) SetUserConfig(w http.ResponseWriter, r *http.Request)
- type MultitenantAlertmanagerConfig
- type RingConfig
- type StatusHandler
- type UserConfig
Constants ¶
const ( // RingKey is the key under which we store the alertmanager ring in the KVStore. RingKey = "alertmanager" // RingNameForServer is the name of the ring used by the alertmanager server. RingNameForServer = "alertmanager" // RingNumTokens is a safe default instead of exposing to config option to the user // in order to simplify the config. RingNumTokens = 128 )
Variables ¶
var RingOp = ring.NewOp([]ring.IngesterState{ring.ACTIVE}, func(s ring.IngesterState) bool { return s != ring.ACTIVE })
RingOp is the operation used for distributing tenants between alertmanagers.
Functions ¶
This section is empty.
Types ¶
type AlertStore ¶ added in v0.7.0
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 ¶ added in v0.7.0
func NewAlertStore(cfg AlertStoreConfig) (AlertStore, error)
NewAlertStore returns a new rule storage backend poller and store
type AlertStoreConfig ¶ added in v0.7.0
type AlertStoreConfig struct { Type string `yaml:"type"` ConfigDB client.Config `yaml:"configdb"` // Object Storage Configs Azure azure.BlobStorageConfig `yaml:"azure"` GCS gcp.GCSConfig `yaml:"gcs"` S3 aws.S3Config `yaml:"s3"` Local local.StoreConfig `yaml:"local"` }
AlertStoreConfig configures the alertmanager backend
func (*AlertStoreConfig) RegisterFlags ¶ added in v0.7.0
func (cfg *AlertStoreConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags registers flags.
func (*AlertStoreConfig) Validate ¶ added in v1.6.0
func (cfg *AlertStoreConfig) Validate() error
Validate config and returns error on failure
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 ¶
ApplyConfig applies a new configuration to an Alertmanager.
func (*Alertmanager) IsActive ¶ added in v0.7.0
func (am *Alertmanager) IsActive() bool
IsActive returns if the alertmanager is currently running or is paused
func (*Alertmanager) Pause ¶ added in v0.7.0
func (am *Alertmanager) Pause()
Pause running jobs in the alertmanager that are able to be restarted and sets to inactives
type ClusterConfig ¶ added in v1.7.0
type ClusterConfig struct { ListenAddr string `yaml:"listen_address"` AdvertiseAddr string `yaml:"advertise_address"` Peers flagext.StringSliceCSV `yaml:"peers"` PeerTimeout time.Duration `yaml:"peer_timeout"` GossipInterval time.Duration `yaml:"gossip_interval"` PushPullInterval time.Duration `yaml:"push_pull_interval"` }
func (*ClusterConfig) RegisterFlags ¶ added in v1.7.0
func (cfg *ClusterConfig) RegisterFlags(f *flag.FlagSet)
func (*ClusterConfig) SupportDeprecatedFlagset ¶ added in v1.7.0
func (cfg *ClusterConfig) SupportDeprecatedFlagset(amCfg *MultitenantAlertmanagerConfig, logger log.Logger)
SupportDeprecatedFlagset ensures we support the previous set of cluster flags that are now deprecated.
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 ¶
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 ¶ added in v1.3.0
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 ¶ added in v1.3.0
func (am *MultitenantAlertmanager) GetUserConfig(w http.ResponseWriter, r *http.Request)
func (*MultitenantAlertmanager) OnRingInstanceHeartbeat ¶ added in v1.7.0
func (r *MultitenantAlertmanager) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.IngesterDesc)
func (*MultitenantAlertmanager) OnRingInstanceRegister ¶ added in v1.7.0
func (r *MultitenantAlertmanager) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, instanceID string, instanceDesc ring.IngesterDesc) (ring.IngesterState, ring.Tokens)
func (*MultitenantAlertmanager) OnRingInstanceStopping ¶ added in v1.7.0
func (r *MultitenantAlertmanager) OnRingInstanceStopping(_ *ring.BasicLifecycler)
func (*MultitenantAlertmanager) OnRingInstanceTokens ¶ added in v1.7.0
func (r *MultitenantAlertmanager) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
func (*MultitenantAlertmanager) RingHandler ¶ added in v1.7.0
func (am *MultitenantAlertmanager) RingHandler(w http.ResponseWriter, req *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 ¶ added in v1.3.0
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"` DeprecatedClusterBindAddr string `yaml:"cluster_bind_address"` DeprecatedClusterAdvertiseAddr string `yaml:"cluster_advertise_address"` DeprecatedPeers flagext.StringSlice `yaml:"peers"` DeprecatedPeerTimeout time.Duration `yaml:"peer_timeout"` // Enable sharding for the Alertmanager ShardingEnabled bool `yaml:"sharding_enabled"` ShardingRing RingConfig `yaml:"sharding_ring"` FallbackConfigFile string `yaml:"fallback_config_file"` AutoWebhookRoot string `yaml:"auto_webhook_root"` Store AlertStoreConfig `yaml:"storage"` Cluster ClusterConfig `yaml:"cluster"` 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.
func (*MultitenantAlertmanagerConfig) Validate ¶ added in v1.6.0
func (cfg *MultitenantAlertmanagerConfig) Validate() error
Validate config and returns error on failure
type RingConfig ¶ added in v1.7.0
type RingConfig struct { KVStore kv.Config `yaml:"kvstore" doc:"description=The key-value store used to share the hash ring across multiple instances."` HeartbeatPeriod time.Duration `yaml:"heartbeat_period"` HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"` ReplicationFactor int `yaml:"replication_factor"` // Instance details InstanceID string `yaml:"instance_id" doc:"hidden"` InstanceInterfaceNames []string `yaml:"instance_interface_names"` InstancePort int `yaml:"instance_port" doc:"hidden"` InstanceAddr string `yaml:"instance_addr" doc:"hidden"` // Injected internally ListenPort int `yaml:"-"` RingCheckPeriod time.Duration `yaml:"-"` // Used for testing SkipUnregister bool `yaml:"-"` }
RingConfig masks the ring lifecycler config which contains many options not really required by the alertmanager ring. This config is used to strip down the config to the minimum, and avoid confusion to the user.
func (*RingConfig) RegisterFlags ¶ added in v1.7.0
func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
func (*RingConfig) ToLifecyclerConfig ¶ added in v1.7.0
func (cfg *RingConfig) ToLifecyclerConfig() (ring.BasicLifecyclerConfig, error)
ToLifecyclerConfig returns a LifecyclerConfig based on the alertmanager ring config.
func (*RingConfig) ToRingConfig ¶ added in v1.7.0
func (cfg *RingConfig) ToRingConfig() ring.Config
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 ¶ added in v1.3.0
type UserConfig struct { TemplateFiles map[string]string `yaml:"template_files"` AlertmanagerConfig string `yaml:"alertmanager_config"` }
UserConfig is used to communicate a users alertmanager configs