Documentation
¶
Overview ¶
Package definitions includes the types required for generating or consuming an OpenAPI spec for the Unified Alerting API. Documentation of the API.
Schemes: http, https BasePath: /api/v1 Version: 1.1.0 Consumes: - application/json Produces: - application/json Security: - basic SecurityDefinitions: basic: type: basic
swagger:meta
Index ¶
- func AllReceivers(route *config.Route) (res []string)
- type Ack
- type Alert
- type AlertDiscovery
- type AlertGroup
- type AlertGroups
- type AlertInstancesResponse
- type AlertManagerNotFound
- type AlertManagerNotReady
- type AlertResponse
- type AlertingRule
- type AlertsParams
- type ApiRuleNode
- type Backend
- type BodyAlertingConfig
- type Config
- type CreateSilenceParams
- type DatasourceReference
- type DiscoveryBase
- type EncryptFn
- type EvalQueriesPayload
- type EvalQueriesRequest
- type EvalQueriesResponse
- type ExecutionErrorState
- type ExtendedReceiver
- type Failure
- type GetDeleteSilenceParams
- type GetRuleStatusesParams
- type GetSilencesParams
- type GettableAlert
- type GettableAlertmanagers
- type GettableAlerts
- type GettableApiAlertingConfig
- type GettableApiReceiver
- type GettableExtendedRuleNode
- type GettableGrafanaReceiver
- type GettableGrafanaReceivers
- type GettableGrafanaRule
- type GettableNGalertConfig
- type GettableRuleGroupConfig
- type GettableSilence
- type GettableSilences
- type GettableStatus
- type GettableUserConfig
- type MultiStatus
- type NGalertConfig
- type NamespaceConfig
- type NamespaceConfigResponse
- type NoDataState
- type ObjectMatchers
- type PathGetRulesParams
- type PathNamespaceConfig
- type PathRouleGroupConfig
- type PermissionDenied
- type PostableAlerts
- type PostableApiAlertingConfig
- type PostableApiReceiver
- type PostableExtendedRuleNode
- type PostableGrafanaReceiver
- type PostableGrafanaReceivers
- type PostableGrafanaRule
- type PostableNGalertConfig
- type PostableRuleGroupConfig
- type PostableSilence
- type PostableUserConfig
- func (c *PostableUserConfig) GetGrafanaReceiverMap() map[string]*PostableGrafanaReceiver
- func (c *PostableUserConfig) MarshalYAML() (interface{}, error)
- func (c *PostableUserConfig) ProcessConfig(encrypt EncryptFn) error
- func (c *PostableUserConfig) UnmarshalJSON(b []byte) error
- func (c *PostableUserConfig) UnmarshalYAML(value *yaml.Node) error
- type Receiver
- type ReceiverType
- type ResponseDetails
- type Route
- type Rule
- type RuleDiscovery
- type RuleGroup
- type RuleGroupConfigResponse
- type RuleResponse
- type RuleType
- type SmtpNotEnabled
- type Success
- type TestReceiverConfigResult
- type TestReceiverRequest
- type TestReceiverResult
- type TestReceiversConfigAlertParams
- type TestReceiversConfigParams
- type TestReceiversResult
- type TestRulePayload
- type TestRuleRequest
- type TestRuleResponse
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllReceivers ¶
AllReceivers will recursively walk a routing tree and return a list of all the referenced receiver names.
Types ¶
type Alert ¶
type Alert struct {
// required: true
Labels overrideLabels `json:"labels"`
// required: true
Annotations overrideLabels `json:"annotations"`
// required: true
State string `json:"state"`
ActiveAt *time.Time `json:"activeAt"`
// required: true
Value string `json:"value"`
}
Alert has info for an alert. swagger:model
type AlertDiscovery ¶
type AlertDiscovery struct {
// required: true
Alerts []*Alert `json:"alerts"`
}
AlertDiscovery has info for all active alerts. swagger:model
type AlertInstancesResponse ¶
type AlertInstancesResponse struct {
// Instances is an array of arrow encoded dataframes
// each frame has a single row, and a column for each instance (alert identified by unique labels) with a boolean value (firing/not firing)
Instances [][]byte `json:"instances"`
}
swagger:model
type AlertResponse ¶
type AlertResponse struct {
// in: body
DiscoveryBase
// in: body
Data AlertDiscovery `json:"data"`
}
swagger:model
type AlertingRule ¶
type AlertingRule struct {
// State can be "pending", "firing", "inactive".
// required: true
State string `json:"state,omitempty"`
// required: true
Name string `json:"name,omitempty"`
// required: true
Query string `json:"query,omitempty"`
Duration float64 `json:"duration,omitempty"`
// required: true
Annotations overrideLabels `json:"annotations,omitempty"`
// required: true
Alerts []*Alert `json:"alerts,omitempty"`
Rule
}
adapted from cortex swagger:model
type AlertsParams ¶
type AlertsParams struct {
// Show active alerts
// in: query
// required: false
// default: true
Active bool `json:"active"`
// Show silenced alerts
// in: query
// required: false
// default: true
Silenced bool `json:"silenced"`
// Show inhibited alerts
// in: query
// required: false
// default: true
Inhibited bool `json:"inhibited"`
// A list of matchers to filter alerts by
// in: query
// required: false
Matchers []string `json:"filter"`
// A regex matching receivers to filter alerts by
// in: query
// required: false
Receivers string `json:"receiver"`
}
swagger:parameters RouteGetAMAlerts RouteGetAMAlertGroups
type ApiRuleNode ¶
type ApiRuleNode struct {
Record string `yaml:"record,omitempty" json:"record,omitempty"`
Alert string `yaml:"alert,omitempty" json:"alert,omitempty"`
Expr string `yaml:"expr" json:"expr"`
For model.Duration `yaml:"for,omitempty" json:"for,omitempty"`
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
type BodyAlertingConfig ¶
type BodyAlertingConfig struct {
// in:body
Body PostableUserConfig
}
swagger:parameters RoutePostAlertingConfig
type Config ¶
type Config struct {
Global *config.GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
Route *Route `yaml:"route,omitempty" json:"route,omitempty"`
InhibitRules []*config.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"`
MuteTimeIntervals []config.MuteTimeInterval `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
Templates []string `yaml:"templates" json:"templates"`
}
Config is the top-level configuration for Alertmanager's config files.
func (*Config) UnmarshalJSON ¶
Config is the entrypoint for the embedded Alertmanager config with the exception of receivers. Prometheus historically uses yaml files as the method of configuration and thus some post-validation is included in the UnmarshalYAML method. Here we simply run this with a noop unmarshaling function in order to benefit from said validation.
type CreateSilenceParams ¶
type CreateSilenceParams struct {
// in:body
Silence PostableSilence
}
swagger:parameters RouteCreateSilence
type DatasourceReference ¶
type DatasourceReference struct {
// Recipient should be "grafana" for requests to be handled by grafana
// and the numeric datasource id for requests to be forwarded to a datasource
// in:path
Recipient string
}
alertmanager routes swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig RoutePostTestReceivers ruler routes swagger:parameters RouteGetRulesConfig RoutePostNameRulesConfig RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig prom routes swagger:parameters RouteGetRuleStatuses RouteGetAlertStatuses testing routes swagger:parameters RouteTestReceiverConfig RouteTestRuleConfig
type DiscoveryBase ¶
type DiscoveryBase struct {
// required: true
Status string `json:"status"`
// required: false
ErrorType v1.ErrorType `json:"errorType,omitempty"`
// required: false
Error string `json:"error,omitempty"`
}
swagger:model
type EvalQueriesPayload ¶
type EvalQueriesPayload struct {
Data []models.AlertQuery `json:"data"`
Now time.Time `json:"now"`
}
swagger:model
type EvalQueriesRequest ¶
type EvalQueriesRequest struct {
// in:body
Body EvalQueriesPayload
}
swagger:parameters RouteEvalQueries
type ExecutionErrorState ¶
type ExecutionErrorState string
swagger:enum ExecutionErrorState
const (
AlertingErrState ExecutionErrorState = "Alerting"
)
type ExtendedReceiver ¶
type ExtendedReceiver struct {
EmailConfigs config.EmailConfig `yaml:"email_configs,omitempty" json:"email_configs,omitempty"`
PagerdutyConfigs config.PagerdutyConfig `yaml:"pagerduty_configs,omitempty" json:"pagerduty_configs,omitempty"`
SlackConfigs config.SlackConfig `yaml:"slack_configs,omitempty" json:"slack_configs,omitempty"`
WebhookConfigs config.WebhookConfig `yaml:"webhook_configs,omitempty" json:"webhook_configs,omitempty"`
OpsGenieConfigs config.OpsGenieConfig `yaml:"opsgenie_configs,omitempty" json:"opsgenie_configs,omitempty"`
WechatConfigs config.WechatConfig `yaml:"wechat_configs,omitempty" json:"wechat_configs,omitempty"`
PushoverConfigs config.PushoverConfig `yaml:"pushover_configs,omitempty" json:"pushover_configs,omitempty"`
VictorOpsConfigs config.VictorOpsConfig `yaml:"victorops_configs,omitempty" json:"victorops_configs,omitempty"`
GrafanaReceiver PostableGrafanaReceiver `yaml:"grafana_managed_receiver,omitempty" json:"grafana_managed_receiver,omitempty"`
}
swagger:model
type GetDeleteSilenceParams ¶
type GetDeleteSilenceParams struct {
// in:path
SilenceId string
}
swagger:parameters RouteGetSilence RouteDeleteSilence
type GetRuleStatusesParams ¶
swagger:parameters RouteGetRuleStatuses
type GetSilencesParams ¶
type GetSilencesParams struct {
// in:query
Filter []string `json:"filter"`
}
swagger:parameters RouteGetSilences
type GettableAlertmanagers ¶
type GettableAlertmanagers struct {
Status string `json:"status"`
Data v1.AlertManagersResult `json:"data"`
}
swagger:model
type GettableApiAlertingConfig ¶
type GettableApiAlertingConfig struct {
Config `yaml:",inline"`
// Override with our superset receiver type
Receivers []*GettableApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
}
func (*GettableApiAlertingConfig) UnmarshalJSON ¶
func (c *GettableApiAlertingConfig) UnmarshalJSON(b []byte) error
type GettableApiReceiver ¶
type GettableApiReceiver struct {
config.Receiver `yaml:",inline"`
GettableGrafanaReceivers `yaml:",inline"`
}
func (*GettableApiReceiver) Type ¶
func (r *GettableApiReceiver) Type() ReceiverType
func (*GettableApiReceiver) UnmarshalJSON ¶
func (r *GettableApiReceiver) UnmarshalJSON(b []byte) error
type GettableExtendedRuleNode ¶
type GettableExtendedRuleNode struct {
// note: this works with yaml v3 but not v2 (the inline tag isn't accepted on pointers in v2)
*ApiRuleNode `yaml:",inline"`
//GrafanaManagedAlert yaml.Node `yaml:"grafana_alert,omitempty"`
GrafanaManagedAlert *GettableGrafanaRule `yaml:"grafana_alert,omitempty" json:"grafana_alert,omitempty"`
}
func (*GettableExtendedRuleNode) Type ¶
func (n *GettableExtendedRuleNode) Type() RuleType
func (*GettableExtendedRuleNode) UnmarshalJSON ¶
func (n *GettableExtendedRuleNode) UnmarshalJSON(b []byte) error
type GettableGrafanaReceiver ¶
type GettableGrafanaReceivers ¶
type GettableGrafanaReceivers struct {
GrafanaManagedReceivers []*GettableGrafanaReceiver `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
}
type GettableGrafanaRule ¶
type GettableGrafanaRule struct {
ID int64 `json:"id" yaml:"id"`
OrgID int64 `json:"orgId" yaml:"orgId"`
Title string `json:"title" yaml:"title"`
Condition string `json:"condition" yaml:"condition"`
Data []models.AlertQuery `json:"data" yaml:"data"`
Updated time.Time `json:"updated" yaml:"updated"`
IntervalSeconds int64 `json:"intervalSeconds" yaml:"intervalSeconds"`
Version int64 `json:"version" yaml:"version"`
UID string `json:"uid" yaml:"uid"`
NamespaceUID string `json:"namespace_uid" yaml:"namespace_uid"`
NamespaceID int64 `json:"namespace_id" yaml:"namespace_id"`
RuleGroup string `json:"rule_group" yaml:"rule_group"`
NoDataState NoDataState `json:"no_data_state" yaml:"no_data_state"`
ExecErrState ExecutionErrorState `json:"exec_err_state" yaml:"exec_err_state"`
}
swagger:model
type GettableNGalertConfig ¶
type GettableNGalertConfig struct {
Alertmanagers []string `json:"alertmanagers"`
}
swagger:model
type GettableRuleGroupConfig ¶
type GettableRuleGroupConfig struct {
Name string `yaml:"name" json:"name"`
Interval model.Duration `yaml:"interval,omitempty" json:"interval,omitempty"`
Rules []GettableExtendedRuleNode `yaml:"rules" json:"rules"`
}
swagger:model
func (*GettableRuleGroupConfig) Type ¶
func (c *GettableRuleGroupConfig) Type() (backend Backend)
Type requires validate has been called and just checks the first rule type
func (*GettableRuleGroupConfig) UnmarshalJSON ¶
func (c *GettableRuleGroupConfig) UnmarshalJSON(b []byte) error
type GettableSilences ¶
type GettableSilences = amv2.GettableSilences
swagger:model gettableSilences
type GettableStatus ¶
type GettableStatus struct {
// cluster
// Required: true
Cluster *amv2.ClusterStatus `json:"cluster"`
// config
// Required: true
Config *PostableApiAlertingConfig `json:"config"`
// uptime
// Required: true
// Format: date-time
Uptime *strfmt.DateTime `json:"uptime"`
// version info
// Required: true
VersionInfo *amv2.VersionInfo `json:"versionInfo"`
}
swagger:model
func NewGettableStatus ¶
func NewGettableStatus(cfg *PostableApiAlertingConfig) *GettableStatus
func (*GettableStatus) UnmarshalJSON ¶
func (s *GettableStatus) UnmarshalJSON(b []byte) error
type GettableUserConfig ¶
type GettableUserConfig struct {
TemplateFiles map[string]string `yaml:"template_files" json:"template_files"`
AlertmanagerConfig GettableApiAlertingConfig `yaml:"alertmanager_config" json:"alertmanager_config"`
// contains filtered or unexported fields
}
swagger:model
func (*GettableUserConfig) GetGrafanaReceiverMap ¶
func (c *GettableUserConfig) GetGrafanaReceiverMap() map[string]*GettableGrafanaReceiver
GetGrafanaReceiverMap returns a map that associates UUIDs to grafana receivers
func (*GettableUserConfig) MarshalJSON ¶
func (c *GettableUserConfig) MarshalJSON() ([]byte, error)
func (*GettableUserConfig) UnmarshalYAML ¶
func (c *GettableUserConfig) UnmarshalYAML(value *yaml.Node) error
type NGalertConfig ¶
type NGalertConfig struct {
// in:body
Body PostableNGalertConfig
}
swagger:parameters RoutePostNGalertConfig
type NamespaceConfig ¶
type NamespaceConfig struct {
// in:path
Namespace string
// in:body
Body PostableRuleGroupConfig
}
swagger:parameters RoutePostNameRulesConfig
type NamespaceConfigResponse ¶
type NamespaceConfigResponse map[string][]GettableRuleGroupConfig
swagger:model
type NoDataState ¶
type NoDataState string
swagger:enum NoDataState
const ( Alerting NoDataState = "Alerting" NoData NoDataState = "NoData" OK NoDataState = "OK" )
type ObjectMatchers ¶
ObjectMatchers is Matchers with a different Unmarshal and Marshal methods that accept matchers as objects that have already been parsed.
func (ObjectMatchers) MarshalJSON ¶
func (m ObjectMatchers) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for Matchers.
func (ObjectMatchers) MarshalYAML ¶
func (m ObjectMatchers) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface for Matchers.
func (*ObjectMatchers) UnmarshalJSON ¶
func (m *ObjectMatchers) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for Matchers.
func (*ObjectMatchers) UnmarshalYAML ¶
func (m *ObjectMatchers) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for Matchers.
type PathGetRulesParams ¶
swagger:parameters RouteGetRulesConfig
type PathNamespaceConfig ¶
type PathNamespaceConfig struct {
// in: path
Namespace string
}
swagger:parameters RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig
type PathRouleGroupConfig ¶
swagger:parameters RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig
type PostableAlerts ¶
type PostableAlerts struct {
// in:body
PostableAlerts []amv2.PostableAlert `yaml:"" json:""`
}
swagger:parameters RoutePostAMAlerts
type PostableApiAlertingConfig ¶
type PostableApiAlertingConfig struct {
Config `yaml:",inline"`
// Override with our superset receiver type
Receivers []*PostableApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
}
func (*PostableApiAlertingConfig) ReceiverType ¶
func (c *PostableApiAlertingConfig) ReceiverType() ReceiverType
Type requires validate has been called and just checks the first receiver type
func (*PostableApiAlertingConfig) UnmarshalJSON ¶
func (c *PostableApiAlertingConfig) UnmarshalJSON(b []byte) error
type PostableApiReceiver ¶
type PostableApiReceiver struct {
config.Receiver `yaml:",inline"`
PostableGrafanaReceivers `yaml:",inline"`
}
func (*PostableApiReceiver) Type ¶
func (r *PostableApiReceiver) Type() ReceiverType
func (*PostableApiReceiver) UnmarshalJSON ¶
func (r *PostableApiReceiver) UnmarshalJSON(b []byte) error
func (*PostableApiReceiver) UnmarshalYAML ¶
func (r *PostableApiReceiver) UnmarshalYAML(unmarshal func(interface{}) error) error
type PostableExtendedRuleNode ¶
type PostableExtendedRuleNode struct {
// note: this works with yaml v3 but not v2 (the inline tag isn't accepted on pointers in v2)
*ApiRuleNode `yaml:",inline"`
//GrafanaManagedAlert yaml.Node `yaml:"grafana_alert,omitempty"`
GrafanaManagedAlert *PostableGrafanaRule `yaml:"grafana_alert,omitempty" json:"grafana_alert,omitempty"`
}
func (*PostableExtendedRuleNode) Type ¶
func (n *PostableExtendedRuleNode) Type() RuleType
func (*PostableExtendedRuleNode) UnmarshalJSON ¶
func (n *PostableExtendedRuleNode) UnmarshalJSON(b []byte) error
type PostableGrafanaReceiver ¶
type PostableGrafanaReceivers ¶
type PostableGrafanaReceivers struct {
GrafanaManagedReceivers []*PostableGrafanaReceiver `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
}
type PostableGrafanaRule ¶
type PostableGrafanaRule struct {
Title string `json:"title" yaml:"title"`
Condition string `json:"condition" yaml:"condition"`
Data []models.AlertQuery `json:"data" yaml:"data"`
UID string `json:"uid" yaml:"uid"`
NoDataState NoDataState `json:"no_data_state" yaml:"no_data_state"`
ExecErrState ExecutionErrorState `json:"exec_err_state" yaml:"exec_err_state"`
}
swagger:model
type PostableNGalertConfig ¶
type PostableNGalertConfig struct {
Alertmanagers []string `json:"alertmanagers"`
}
swagger:model
type PostableRuleGroupConfig ¶
type PostableRuleGroupConfig struct {
Name string `yaml:"name" json:"name"`
Interval model.Duration `yaml:"interval,omitempty" json:"interval,omitempty"`
Rules []PostableExtendedRuleNode `yaml:"rules" json:"rules"`
}
swagger:model
func (*PostableRuleGroupConfig) Type ¶
func (c *PostableRuleGroupConfig) Type() (backend Backend)
Type requires validate has been called and just checks the first rule type
func (*PostableRuleGroupConfig) UnmarshalJSON ¶
func (c *PostableRuleGroupConfig) UnmarshalJSON(b []byte) error
type PostableUserConfig ¶
type PostableUserConfig struct {
TemplateFiles map[string]string `yaml:"template_files" json:"template_files"`
AlertmanagerConfig PostableApiAlertingConfig `yaml:"alertmanager_config" json:"alertmanager_config"`
// contains filtered or unexported fields
}
swagger:model
func (*PostableUserConfig) GetGrafanaReceiverMap ¶
func (c *PostableUserConfig) GetGrafanaReceiverMap() map[string]*PostableGrafanaReceiver
GetGrafanaReceiverMap returns a map that associates UUIDs to grafana receivers
func (*PostableUserConfig) MarshalYAML ¶
func (c *PostableUserConfig) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaller.
func (*PostableUserConfig) ProcessConfig ¶
func (c *PostableUserConfig) ProcessConfig(encrypt EncryptFn) error
ProcessConfig parses grafana receivers, encrypts secrets and assigns UUIDs (if they are missing)
func (*PostableUserConfig) UnmarshalJSON ¶
func (c *PostableUserConfig) UnmarshalJSON(b []byte) error
func (*PostableUserConfig) UnmarshalYAML ¶
func (c *PostableUserConfig) UnmarshalYAML(value *yaml.Node) error
type ReceiverType ¶
type ReceiverType int
const ( GrafanaReceiverType ReceiverType = 1 << iota AlertmanagerReceiverType EmptyReceiverType = GrafanaReceiverType | AlertmanagerReceiverType )
func (ReceiverType) Can ¶
func (r ReceiverType) Can(other ReceiverType) bool
Can determines whether a receiver type can implement another receiver type. This is useful as receivers with just names but no contact points are valid in all backends.
func (ReceiverType) MatchesBackend ¶
func (r ReceiverType) MatchesBackend(backend Backend) error
MatchesBackend determines if a config payload can be sent to a particular backend type
func (ReceiverType) String ¶
func (r ReceiverType) String() string
type Route ¶
type Route struct {
Receiver string `yaml:"receiver,omitempty" json:"receiver,omitempty"`
GroupByStr []string `yaml:"group_by,omitempty" json:"group_by,omitempty"`
GroupBy []model.LabelName `yaml:"-" json:"-"`
GroupByAll bool `yaml:"-" json:"-"`
// Deprecated. Remove before v1.0 release.
Match map[string]string `yaml:"match,omitempty" json:"match,omitempty"`
// Deprecated. Remove before v1.0 release.
MatchRE config.MatchRegexps `yaml:"match_re,omitempty" json:"match_re,omitempty"`
Matchers config.Matchers `yaml:"matchers,omitempty" json:"matchers,omitempty"`
ObjectMatchers ObjectMatchers `yaml:"object_matchers,omitempty" json:"object_matchers,omitempty"`
MuteTimeIntervals []string `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
Continue bool `yaml:"continue" json:"continue,omitempty"`
Routes []*Route `yaml:"routes,omitempty" json:"routes,omitempty"`
GroupWait *model.Duration `yaml:"group_wait,omitempty" json:"group_wait,omitempty"`
GroupInterval *model.Duration `yaml:"group_interval,omitempty" json:"group_interval,omitempty"`
RepeatInterval *model.Duration `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty"`
}
A Route is a node that contains definitions of how to handle alerts. This is modified from the upstream alertmanager in that it adds the ObjectMatchers property.
func AsGrafanaRoute ¶
Return a Grafana route from an alertmanager route. The Matchers are converted to ObjectMatchers.
func (*Route) AsAMRoute ¶
Return an alertmanager route from a Grafana route. The ObjectMatchers are converted to Matchers.
func (*Route) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Route. This is a copy of alertmanager's upstream except it removes validation on the label key.
type Rule ¶
type Rule struct {
// required: true
Name string `json:"name"`
// required: true
Query string `json:"query"`
Labels overrideLabels `json:"labels"`
// required: true
Health string `json:"health"`
LastError string `json:"lastError"`
// required: true
Type v1.RuleType `json:"type"`
LastEvaluation time.Time `json:"lastEvaluation"`
EvaluationTime float64 `json:"evaluationTime"`
}
adapted from cortex swagger:model
type RuleDiscovery ¶
type RuleDiscovery struct {
// required: true
RuleGroups []*RuleGroup `json:"groups"`
}
swagger:model
type RuleGroup ¶
type RuleGroup struct {
// required: true
Name string `json:"name"`
// required: true
File string `json:"file"`
// In order to preserve rule ordering, while exposing type (alerting or recording)
// specific properties, both alerting and recording rules are exposed in the
// same array.
// required: true
Rules []AlertingRule `json:"rules"`
// required: true
Interval float64 `json:"interval"`
LastEvaluation time.Time `json:"lastEvaluation"`
EvaluationTime float64 `json:"evaluationTime"`
}
swagger:model
type RuleGroupConfigResponse ¶
type RuleGroupConfigResponse struct {
GettableRuleGroupConfig
}
swagger:model
type RuleResponse ¶
type RuleResponse struct {
// in: body
DiscoveryBase
// in: body
Data RuleDiscovery `json:"data"`
}
swagger:model
type TestReceiverConfigResult ¶
type TestReceiverConfigResult struct {
Name string `json:"name"`
UID string `json:"uid"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
swagger:model
type TestReceiverRequest ¶
type TestReceiverRequest struct {
// in:body
Body ExtendedReceiver
}
swagger:parameters RouteTestReceiverConfig
type TestReceiverResult ¶
type TestReceiverResult struct {
Name string `json:"name"`
Configs []TestReceiverConfigResult `json:"grafana_managed_receiver_configs"`
}
swagger:model
type TestReceiversConfigParams ¶
type TestReceiversConfigParams struct {
// in:body
Alert *TestReceiversConfigAlertParams `yaml:"alert,omitempty" json:"alert,omitempty"`
// in:body
Receivers []*PostableApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
}
swagger:parameters RoutePostTestReceivers
func (*TestReceiversConfigParams) ProcessConfig ¶
func (c *TestReceiversConfigParams) ProcessConfig(encrypt EncryptFn) error
type TestReceiversResult ¶
type TestReceiversResult struct {
Alert TestReceiversConfigAlertParams `json:"alert"`
Receivers []TestReceiverResult `json:"receivers"`
NotifiedAt time.Time `json:"notified_at"`
}
swagger:model
type TestRulePayload ¶
type TestRulePayload struct {
// Example: (node_filesystem_avail_bytes{fstype!="",job="integrations/node_exporter"} node_filesystem_size_bytes{fstype!="",job="integrations/node_exporter"} * 100 < 5 and node_filesystem_readonly{fstype!="",job="integrations/node_exporter"} == 0)
Expr string `json:"expr,omitempty"`
// GrafanaManagedCondition for grafana alerts
GrafanaManagedCondition *models.EvalAlertConditionCommand `json:"grafana_condition,omitempty"`
}
swagger:model
func (*TestRulePayload) Type ¶
func (p *TestRulePayload) Type() (backend Backend)
func (*TestRulePayload) UnmarshalJSON ¶
func (p *TestRulePayload) UnmarshalJSON(b []byte) error
type TestRuleRequest ¶
type TestRuleRequest struct {
// in:body
Body TestRulePayload
}
swagger:parameters RouteTestRuleConfig
type TestRuleResponse ¶
type TestRuleResponse struct {
Alerts promql.Vector `json:"alerts"`
GrafanaAlertInstances AlertInstancesResponse `json:"grafana_alert_instances"`
}
swagger:model