Documentation ¶
Index ¶
- func DedupAlerts() []models.AlertGroup
- func DedupAutocomplete() []models.Autocomplete
- func DedupColors() models.LabelsColorMap
- func NewHTTPTransport(caPath, certPath, keyPath string) (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) Colors() models.LabelsColorMap
- func (am *Alertmanager) Error() string
- func (am *Alertmanager) Pull() error
- func (am *Alertmanager) SilenceByID(id string) (models.Silence, error)
- 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 NewHTTPTransport ¶ added in v0.9.0
func NewHTTPTransport(caPath, certPath, keyPath string) (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"` 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:"-"` // 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) 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) Pull ¶
func (am *Alertmanager) Pull() error
Pull data from upstream Alertmanager instance
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
type Option ¶ added in v0.9.0
type Option func(am *Alertmanager) error
Option allows to pass functional options to NewAlertmanager()
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 unsee 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