Documentation
¶
Index ¶
- Constants
- Variables
- type AlertBody
- type AlertProvider
- func (provider *AlertProvider) GetConfig(group string, alert *alert.Alert) (*Config, error)
- func (provider *AlertProvider) GetDefaultAlert() *alert.Alert
- func (provider *AlertProvider) Send(ep *endpoint.Endpoint, alert *alert.Alert, result *endpoint.Result, ...) error
- func (provider *AlertProvider) Validate() error
- func (provider *AlertProvider) ValidateOverrides(group string, alert *alert.Alert) error
- type Config
Constants ¶
View Source
const ( DefaultSeverity = "critical" DefaultMonitoringTool = "gatus" )
Variables ¶
View Source
var ( ErrInvalidWebhookURL = fmt.Errorf("invalid webhook-url") ErrAuthorizationKeyNotSet = fmt.Errorf("authorization-key not set") )
Functions ¶
This section is empty.
Types ¶
type AlertBody ¶
type AlertBody struct { Title string `json:"title,omitempty"` // The title of the alert. Description string `json:"description,omitempty"` // A high-level summary of the problem. StartTime string `json:"start_time,omitempty"` // The time of the alert. If none is provided, a current time is used. EndTime string `json:"end_time,omitempty"` // The resolution time of the alert. If provided, the alert is resolved. Service string `json:"service,omitempty"` // The affected service. MonitoringTool string `json:"monitoring_tool,omitempty"` // The name of the associated monitoring tool. Hosts string `json:"hosts,omitempty"` // One or more hosts, as to where this incident occurred. Severity string `json:"severity,omitempty"` // The severity of the alert. Case-insensitive. Can be one of: critical, high, medium, low, info, unknown. Defaults to critical if missing or value is not in this list. Fingerprint string `json:"fingerprint,omitempty"` // The unique identifier of the alert. This can be used to group occurrences of the same alert. GitlabEnvironmentName string `json:"gitlab_environment_name,omitempty"` // The name of the associated GitLab environment. Required to display alerts on a dashboard. }
type AlertProvider ¶
type AlertProvider struct { DefaultConfig Config `yaml:",inline"` // DefaultAlert is the default alert configuration to use for endpoints with an alert of the appropriate type DefaultAlert *alert.Alert `yaml:"default-alert,omitempty"` }
AlertProvider is the configuration necessary for sending an alert using GitLab
func (*AlertProvider) GetConfig ¶ added in v5.14.0
GetConfig returns the configuration for the provider with the overrides applied
func (*AlertProvider) GetDefaultAlert ¶
func (provider *AlertProvider) GetDefaultAlert() *alert.Alert
GetDefaultAlert returns the provider's default alert configuration
func (*AlertProvider) Send ¶
func (provider *AlertProvider) Send(ep *endpoint.Endpoint, alert *alert.Alert, result *endpoint.Result, resolved bool) error
Send creates an issue in the designed RepositoryURL if the resolved parameter passed is false, or closes the relevant issue(s) if the resolved parameter passed is true.
func (*AlertProvider) Validate ¶ added in v5.14.0
func (provider *AlertProvider) Validate() error
Validate the provider's configuration
func (*AlertProvider) ValidateOverrides ¶ added in v5.14.0
func (provider *AlertProvider) ValidateOverrides(group string, alert *alert.Alert) error
ValidateOverrides validates the alert's provider override and, if present, the group override
type Config ¶ added in v5.14.0
type Config struct { WebhookURL string `yaml:"webhook-url"` // The webhook url provided by GitLab AuthorizationKey string `yaml:"authorization-key"` // The authorization key provided by GitLab Severity string `yaml:"severity,omitempty"` // Severity can be one of: critical, high, medium, low, info, unknown. Defaults to critical MonitoringTool string `yaml:"monitoring-tool,omitempty"` // MonitoringTool overrides the name sent to gitlab. Defaults to gatus EnvironmentName string `yaml:"environment-name,omitempty"` // EnvironmentName is the name of the associated GitLab environment. Required to display alerts on a dashboard. Service string `yaml:"service,omitempty"` // Service affected. Defaults to the endpoint's display name }
Click to show internal directories.
Click to hide internal directories.