Documentation ¶
Index ¶
- func DedupAlerts() []models.AlertGroup
- func DedupAutocomplete() []models.Autocomplete
- func DedupColors() models.LabelsColorMap
- func DedupKnownLabelValues(name string) []string
- func DedupKnownLabels() []string
- func DedupSilences() []models.ManagedSilence
- func NewHTTPTransport(caPath, certPath, keyPath string, insecureSkipVerify bool) (http.RoundTripper, error)
- func RegisterAlertmanager(am *Alertmanager) error
- type Alertmanager
- func (am *Alertmanager) Alerts() []models.AlertGroup
- func (am *Alertmanager) Autocomplete() []models.Autocomplete
- func (am *Alertmanager) ClusterID() string
- func (am *Alertmanager) ClusterMemberNames() []string
- func (am *Alertmanager) ClusterPeers() []string
- func (am *Alertmanager) Colors() models.LabelsColorMap
- func (am *Alertmanager) Error() string
- func (am *Alertmanager) InternalURI() string
- func (am *Alertmanager) KnownLabels() []string
- func (am *Alertmanager) PublicURI() string
- func (am *Alertmanager) Pull() error
- func (am *Alertmanager) SanitizedURI() string
- func (am *Alertmanager) SilenceByID(id string) (models.Silence, error)
- func (am *Alertmanager) Silences() map[string]models.Silence
- func (am *Alertmanager) Version() string
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DedupAlerts ¶
func DedupAlerts() []models.AlertGroup
DedupAlerts will collect alert groups from all defined Alertmanager upstreams and deduplicate them, so we only return unique alerts
func DedupAutocomplete ¶
func DedupAutocomplete() []models.Autocomplete
DedupAutocomplete returns a list of autocomplete hints merged from all Alertmanager upstreams
func DedupColors ¶
func DedupColors() models.LabelsColorMap
DedupColors returns a color map merged from all Alertmanager upstream color maps
func DedupKnownLabelValues ¶ added in v0.48.1
DedupKnownLabelValues returns a list of all known values for label $name
func DedupKnownLabels ¶ added in v0.48.1
func DedupKnownLabels() []string
DedupKnownLabels returns a deduplicated slice of all known label names
func DedupSilences ¶ added in v0.48.1
func DedupSilences() []models.ManagedSilence
DedupKnownLabels returns a deduplicated slice of all known label names
func NewHTTPTransport ¶ added in v0.9.0
func NewHTTPTransport(caPath, certPath, keyPath string, insecureSkipVerify bool) (http.RoundTripper, error)
NewHTTPTransport handles the logic of creating a http.RoundTripper instance with properl tls.Config setup
func RegisterAlertmanager ¶ added in v0.9.0
func RegisterAlertmanager(am *Alertmanager) error
RegisterAlertmanager will add an Alertmanager instance to the list of instances used when pulling alerts from upstreams
Types ¶
type Alertmanager ¶
type Alertmanager struct { URI string `json:"uri"` ExternalURI string `json:"-"` RequestTimeout time.Duration `json:"timeout"` Name string `json:"name"` // whenever this instance should be proxied ProxyRequests bool `json:"proxyRequests"` // implements how we fetch requests from the Alertmanager, we don't set it // by default so it's nil and http.DefaultTransport is used HTTPTransport http.RoundTripper `json:"-"` // metrics tracked per alertmanager instance Metrics alertmanagerMetrics // headers to send with each AlertManager request HTTPHeaders map[string]string // contains filtered or unexported fields }
Alertmanager represents Alertmanager upstream instance
func GetAlertmanagerByName ¶
func GetAlertmanagerByName(name string) *Alertmanager
GetAlertmanagerByName returns an instance of Alertmanager by name or nil if not found
func GetAlertmanagers ¶
func GetAlertmanagers() []*Alertmanager
GetAlertmanagers returns a list of all defined Alertmanager instances
func NewAlertmanager ¶
func NewAlertmanager(name, upstreamURI string, opts ...Option) (*Alertmanager, error)
NewAlertmanager creates a new Alertmanager instance
func (*Alertmanager) Alerts ¶
func (am *Alertmanager) Alerts() []models.AlertGroup
Alerts returns a copy of all alert groups
func (*Alertmanager) Autocomplete ¶
func (am *Alertmanager) Autocomplete() []models.Autocomplete
Autocomplete returns a copy of all autocomplete data
func (*Alertmanager) ClusterID ¶ added in v0.48.1
func (am *Alertmanager) ClusterID() string
ClusterID returns the ID (sha1) of the cluster this Alertmanager instance belongs to
func (*Alertmanager) ClusterMemberNames ¶ added in v0.48.1
func (am *Alertmanager) ClusterMemberNames() []string
ClusterMemberNames returns a list of names of all Alertmanager instances that are in the same cluster as this instance (including self). Names are the same as in karma configuration.
func (*Alertmanager) ClusterPeers ¶ added in v0.48.1
func (am *Alertmanager) ClusterPeers() []string
ClusterPeers returns a list of IDs of all peers this instance is connected to. IDs are the same as in Alertmanager API.
func (*Alertmanager) Colors ¶
func (am *Alertmanager) Colors() models.LabelsColorMap
Colors returns a copy of all color maps
func (*Alertmanager) Error ¶
func (am *Alertmanager) Error() string
func (*Alertmanager) InternalURI ¶ added in v0.48.1
func (am *Alertmanager) InternalURI() string
InternalURI is the URI of this Alertmanager that will be used for all request made by the UI
func (*Alertmanager) KnownLabels ¶ added in v0.48.1
func (am *Alertmanager) KnownLabels() []string
KnownLabels returns a copy of a map with known labels
func (*Alertmanager) PublicURI ¶ added in v0.48.1
func (am *Alertmanager) PublicURI() string
PublicURI is the URI of this Alertmanager that will be used for browser links
func (*Alertmanager) Pull ¶
func (am *Alertmanager) Pull() error
Pull data from upstream Alertmanager instance
func (*Alertmanager) SanitizedURI ¶ added in v0.48.1
func (am *Alertmanager) SanitizedURI() string
SanitizedURI returns a copy of Alertmanager.URI with password replaced by "xxx"
func (*Alertmanager) SilenceByID ¶
func (am *Alertmanager) SilenceByID(id string) (models.Silence, error)
SilenceByID allows to query for a silence by it's ID, returns error if not found
func (*Alertmanager) Silences ¶ added in v0.48.1
func (am *Alertmanager) Silences() map[string]models.Silence
Silences returns a copy of all silences
func (*Alertmanager) Version ¶ added in v0.48.1
func (am *Alertmanager) Version() string
Version returns last known version of this Alertmanager instance
type Option ¶ added in v0.9.0
type Option func(am *Alertmanager) error
Option allows to pass functional options to NewAlertmanager()
func WithExternalURI ¶ added in v0.48.1
WithExternalURI option allows to set custom ExternalURI on our instance
func WithHTTPHeaders ¶ added in v0.48.1
WithHTTPHeaders option can be passed to NewAlertManager in order to set a map of headers that will be passed with every request
func WithHTTPTransport ¶ added in v0.9.0
func WithHTTPTransport(httpTransport http.RoundTripper) Option
WithHTTPTransport option can be passed to NewAlertmanager in order to set a custom HTTP transport (http.RoundTripper implementation)
func WithProxy ¶ added in v0.9.0
WithProxy option can be passed to NewAlertmanager in order to enable request proxying for karma clients
func WithRequestTimeout ¶ added in v0.9.0
WithRequestTimeout option can be passed to NewAlertmanager in order to set a custom timeout for Alertmanager upstream requests