Documentation ¶
Overview ¶
Grafana Alerting API.
Package definitions includes the types required for generating or consuming an OpenAPI spec for the Grafana Alerting 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 ¶
- Constants
- func AlertsByImportance(a1, a2 *Alert) bool
- func AllReceivers(route *config.Route) (res []string)
- func RuleGroupsByFileAndName(a1, a2 *RuleGroup) bool
- type Ack
- type Alert
- type AlertDiscovery
- type AlertGroup
- type AlertGroups
- type AlertInstancesResponse
- type AlertManagerNotReady
- type AlertQuery
- type AlertQueryExport
- type AlertResponse
- type AlertRuleExport
- type AlertRuleGroup
- type AlertRuleGroupExport
- type AlertRuleGroupMetadata
- type AlertRuleGroupPayload
- type AlertRuleHeaders
- type AlertRulePayload
- type AlertRuleUIDReference
- type AlertingFileExport
- type AlertingRule
- type AlertingStatus
- type AlertmanagersChoice
- type AlertsBy
- type AlertsParams
- type AlertsSorter
- type ApiRuleNode
- type Backend
- type BacktestConfig
- type BacktestConfigRequest
- type BacktestResult
- type BodyAlertingConfig
- type Config
- type ContactPointExport
- type ContactPointParams
- type ContactPointPayload
- type ContactPointUIDReference
- type ContactPoints
- type CreateSilenceParams
- type DatasourceUIDReference
- type DecryptQueryParams
- type DiscoveryBase
- type Duration
- type EmbeddedContactPoint
- type EncryptFn
- type EvalAlertConditionCommand
- type EvalQueriesPayload
- type EvalQueriesRequest
- type EvalQueriesResponse
- type ExecutionErrorState
- type ExportQueryParams
- type ExtendedReceiver
- type Failure
- type FolderUIDPathParam
- type GetDeleteSilenceParams
- type GetGrafanaAlertStatusesParams
- type GetGrafanaRuleStatusesParams
- type GetSilencesParams
- type GettableAlert
- type GettableAlertmanagers
- type GettableAlerts
- type GettableApiAlertingConfig
- type GettableApiReceiver
- type GettableExtendedRuleNode
- type GettableGrafanaReceiver
- type GettableGrafanaReceivers
- type GettableGrafanaRule
- type GettableHistoricUserConfig
- type GettableHistoricUserConfigs
- type GettableNGalertConfig
- type GettableRuleGroupConfig
- type GettableSilence
- type GettableSilences
- type GettableStatus
- type GettableUserConfig
- type HistoricalConfigId
- type Integration
- type MultiStatus
- type MuteTimeInterval
- type MuteTimingPayload
- type MuteTimings
- type NGalertConfig
- type NamespaceConfig
- type NamespaceConfigResponse
- type NoDataState
- type NotFound
- type NotificationTemplate
- type NotificationTemplateContent
- type NotificationTemplatePayload
- type NotificationTemplates
- type ObjectMatchers
- type PathGetRulesParams
- type PathNamespaceConfig
- type PathRouleGroupConfig
- type PermissionDenied
- type Policytree
- type PostSilencesOKBody
- type PostableAlerts
- type PostableApiAlertingConfig
- type PostableApiReceiver
- type PostableExtendedRuleNode
- type PostableExtendedRuleNodeExtended
- type PostableGrafanaReceiver
- type PostableGrafanaReceivers
- type PostableGrafanaRule
- type PostableNGalertConfig
- type PostableRuleGroupConfig
- type PostableSilence
- type PostableUserConfig
- func (c *PostableUserConfig) AssignMissingConfigUIDs() error
- func (c *PostableUserConfig) EncryptConfig(encrypt EncryptFn) error
- func (c *PostableUserConfig) GetGrafanaReceiverMap() map[string]*PostableGrafanaReceiver
- func (c *PostableUserConfig) MarshalYAML() (interface{}, error)
- func (c *PostableUserConfig) UnmarshalJSON(b []byte) error
- func (c *PostableUserConfig) UnmarshalYAML(value *yaml.Node) error
- type Provenance
- type ProvisionedAlertRule
- type ProvisionedAlertRules
- type RawMessage
- type Receiver
- type ReceiverExport
- type ReceiverType
- type ReceiversResponse
- type RelativeTimeRange
- type ResponseDetails
- type Route
- func (r *Route) AsAMRoute() *config.Route
- func (r *Route) ResourceID() string
- func (r *Route) ResourceType() string
- func (r *Route) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (r *Route) Validate() error
- func (r *Route) ValidateMuteTimes(muteTimes map[string]struct{}) error
- func (r *Route) ValidateReceivers(receivers map[string]struct{}) error
- type RouteGetGrafanaAlertingConfigHistoryParams
- type RouteGetMuteTimingParam
- type RouteGetTemplateParam
- type Rule
- type RuleDiscovery
- type RuleGroup
- type RuleGroupConfigResponse
- type RuleGroupPathParam
- type RuleGroupsBy
- type RuleGroupsSorter
- type RuleResponse
- type RuleType
- type SmtpNotEnabled
- type StateByImportance
- type StateHistory
- type Success
- type TemplateErrorKind
- type TestGrafanaRuleRequest
- type TestGrafanaRuleResponse
- type TestReceiverConfigResult
- type TestReceiverRequest
- type TestReceiverResult
- type TestReceiversConfigAlertParams
- type TestReceiversConfigBodyParams
- type TestReceiversConfigParams
- type TestReceiversResult
- type TestRulePayload
- type TestRuleRequest
- type TestRuleResponse
- type TestTemplatesConfigBodyParams
- type TestTemplatesConfigParams
- type TestTemplatesErrorResult
- type TestTemplatesResult
- type TestTemplatesResults
- type ValidationError
Constants ¶
const ( StateAlerting = iota StatePending StateError StateNoData StateNormal )
const RedactedValue = "[REDACTED]"
Variables ¶
This section is empty.
Functions ¶
func AlertsByImportance ¶
AlertsByImportance orders alerts by importance. An alert is more important than another alert if its status has higher importance. For example, "alerting" is more important than "normal". If two alerts have the same importance then the ordering is based on their ActiveAt time and their labels.
func AllReceivers ¶
AllReceivers will recursively walk a routing tree and return a list of all the referenced receiver names.
func RuleGroupsByFileAndName ¶
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 AlertQuery ¶
type AlertQuery struct { // RefID is the unique identifier of the query, set by the frontend call. RefID string `json:"refId"` // QueryType is an optional identifier for the type of query. // It can be used to distinguish different types of queries. QueryType string `json:"queryType"` // RelativeTimeRange is the relative Start and End of the query as sent by the frontend. RelativeTimeRange RelativeTimeRange `json:"relativeTimeRange"` // Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation. DatasourceUID string `json:"datasourceUid"` // JSON is the raw JSON query and includes the above properties as well as custom properties. Model json.RawMessage `json:"model"` }
AlertQuery represents a single query associated with an alert definition.
type AlertQueryExport ¶
type AlertQueryExport struct { RefID string `json:"refId" yaml:"refId"` QueryType string `json:"queryType,omitempty" yaml:"queryType,omitempty"` RelativeTimeRange RelativeTimeRange `json:"relativeTimeRange,omitempty" yaml:"relativeTimeRange,omitempty"` DatasourceUID string `json:"datasourceUid" yaml:"datasourceUid"` Model map[string]interface{} `json:"model" yaml:"model"` }
AlertQueryExport is the provisioned export of models.AlertQuery.
type AlertResponse ¶
type AlertResponse struct { // in: body DiscoveryBase // in: body Data AlertDiscovery `json:"data"` }
swagger:model
type AlertRuleExport ¶
type AlertRuleExport struct { UID string `json:"uid" yaml:"uid"` Title string `json:"title" yaml:"title"` Condition string `json:"condition" yaml:"condition"` Data []AlertQueryExport `json:"data" yaml:"data"` DashboardUID string `json:"dasboardUid,omitempty" yaml:"dashboardUid,omitempty"` PanelID int64 `json:"panelId,omitempty" yaml:"panelId,omitempty"` NoDataState NoDataState `json:"noDataState" yaml:"noDataState"` ExecErrState ExecutionErrorState `json:"execErrState" yaml:"execErrState"` For model.Duration `json:"for" yaml:"for"` Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` IsPaused bool `json:"isPaused" yaml:"isPaused"` }
AlertRuleExport is the provisioned file export of models.AlertRule.
type AlertRuleGroup ¶
type AlertRuleGroup struct { Title string `json:"title"` FolderUID string `json:"folderUid"` Interval int64 `json:"interval"` Rules []ProvisionedAlertRule `json:"rules"` }
swagger:model
type AlertRuleGroupExport ¶
type AlertRuleGroupExport struct { OrgID int64 `json:"orgId" yaml:"orgId"` Name string `json:"name" yaml:"name"` Folder string `json:"folder" yaml:"folder"` Interval model.Duration `json:"interval" yaml:"interval"` Rules []AlertRuleExport `json:"rules" yaml:"rules"` }
AlertRuleGroupExport is the provisioned file export of AlertRuleGroupV1.
type AlertRuleGroupMetadata ¶
type AlertRuleGroupMetadata struct {
Interval int64 `json:"interval"`
}
swagger:model
type AlertRuleGroupPayload ¶
type AlertRuleGroupPayload struct { // in:body Body AlertRuleGroup }
swagger:parameters RoutePutAlertRuleGroup
type AlertRuleHeaders ¶
type AlertRuleHeaders struct { // in:header XDisableProvenance string `json:"X-Disable-Provenance"` }
swagger:parameters RoutePostAlertRule RoutePutAlertRule
type AlertRulePayload ¶
type AlertRulePayload struct { // in:body Body ProvisionedAlertRule }
swagger:parameters RoutePostAlertRule RoutePutAlertRule
type AlertRuleUIDReference ¶
type AlertRuleUIDReference struct { // Alert rule UID // in:path UID string }
swagger:parameters RouteGetAlertRule RoutePutAlertRule RouteDeleteAlertRule RouteGetAlertRuleExport
type AlertingFileExport ¶
type AlertingFileExport struct { APIVersion int64 `json:"apiVersion" yaml:"apiVersion"` Groups []AlertRuleGroupExport `json:"groups,omitempty" yaml:"groups,omitempty"` ContactPoints []ContactPointExport `json:"contactPoints,omitempty" yaml:"contactPoints,omitempty"` }
AlertingFileExport is the full provisioned file export. 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 ActiveAt *time.Time `json:"activeAt,omitempty"` Alerts []Alert `json:"alerts,omitempty"` Totals map[string]int64 `json:"totals,omitempty"` TotalsFiltered map[string]int64 `json:"totalsFiltered,omitempty"` Rule }
adapted from cortex swagger:model
type AlertingStatus ¶
type AlertingStatus struct { AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"` NumExternalAlertmanagers int `json:"numExternalAlertmanagers"` }
swagger:model
type AlertmanagersChoice ¶
type AlertmanagersChoice string
swagger:enum AlertmanagersChoice
const ( AllAlertmanagers AlertmanagersChoice = "all" InternalAlertmanager AlertmanagersChoice = "internal" ExternalAlertmanagers AlertmanagersChoice = "external" HandleGrafanaManagedAlerts = "handleGrafanaManagedAlerts" )
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 RouteGetGrafanaAMAlerts RouteGetGrafanaAMAlertGroups
type AlertsSorter ¶
type AlertsSorter struct {
// contains filtered or unexported fields
}
func (AlertsSorter) Len ¶
func (s AlertsSorter) Len() int
func (AlertsSorter) Less ¶
func (s AlertsSorter) Less(i, j int) bool
func (AlertsSorter) Swap ¶
func (s AlertsSorter) Swap(i, j int)
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 BacktestConfig ¶
type BacktestConfig struct { From time.Time `json:"from"` To time.Time `json:"to"` Interval model.Duration `json:"interval,omitempty"` Condition string `json:"condition"` Data []AlertQuery `json:"data"` For model.Duration `json:"for,omitempty"` Title string `json:"title"` Labels map[string]string `json:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` NoDataState NoDataState `json:"no_data_state"` }
swagger:model
type BacktestConfigRequest ¶
type BacktestConfigRequest struct { // in:body Body BacktestConfig }
swagger:parameters BacktestConfig
type BodyAlertingConfig ¶
type BodyAlertingConfig struct { // in:body Body PostableUserConfig }
swagger:parameters RoutePostAlertingConfig RoutePostGrafanaAlertingConfig
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 ContactPointExport ¶
type ContactPointExport struct { OrgID int64 `json:"orgId" yaml:"orgId"` Name string `json:"name" yaml:"name"` Receivers []ReceiverExport `json:"receivers" yaml:"receivers"` }
ContactPointExport is the provisioned file export of alerting.ContactPointV1.
type ContactPointParams ¶
type ContactPointParams struct { // Filter by name // in: query // required: false Name string `json:"name"` }
swagger:parameters RouteGetContactpoints RouteGetContactpointsExport
type ContactPointPayload ¶
type ContactPointPayload struct { // in:body Body EmbeddedContactPoint }
swagger:parameters RoutePostContactpoints RoutePutContactpoint
type ContactPointUIDReference ¶
type ContactPointUIDReference struct { // UID is the contact point unique identifier // in:path UID string }
swagger:parameters RoutePutContactpoint RouteDeleteContactpoints RouteGetContactpoint RouteGetContactpointExport
type CreateSilenceParams ¶
type CreateSilenceParams struct { // in:body Silence PostableSilence }
swagger:parameters RouteCreateSilence RouteCreateGrafanaSilence
type DatasourceUIDReference ¶
type DatasourceUIDReference struct { // DatasoureUID should be the datasource UID identifier // in:path DatasourceUID string }
alertmanager routes swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig testing routes swagger:parameters RouteTestRuleConfig prom routes swagger:parameters RouteGetRuleStatuses RouteGetAlertStatuses ruler routes swagger:parameters RouteGetRulesConfig RoutePostNameRulesConfig RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig
type DecryptQueryParams ¶
type DecryptQueryParams struct { // Whether any contained secure settings should be decrypted or left redacted. Redacted settings will contain RedactedValue instead. Currently, only org admin can view decrypted secure settings. // in: query // required: false // default: false Decrypt bool `json:"decrypt"` }
swagger:parameters RouteGetContactpointsExport RouteGetContactpointExport
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 Duration ¶
Duration is a type used for marshalling durations.
func (Duration) MarshalJSON ¶
func (Duration) MarshalYAML ¶
func (*Duration) UnmarshalJSON ¶
func (*Duration) UnmarshalYAML ¶
type EmbeddedContactPoint ¶
type EmbeddedContactPoint struct { // UID is the unique identifier of the contact point. The UID can be // set by the user. // example: my_external_reference UID string `json:"uid"` // Name is used as grouping key in the UI. Contact points with the // same name will be grouped in the UI. // example: webhook_1 Name string `json:"name" binding:"required"` // required: true // example: webhook // enum: alertmanager, dingding, discord, email, googlechat, kafka, line, opsgenie, pagerduty, pushover, sensugo, slack, teams, telegram, threema, victorops, webhook, wecom Type string `json:"type" binding:"required"` // required: true Settings *simplejson.Json `json:"settings" binding:"required"` // example: false DisableResolveMessage bool `json:"disableResolveMessage"` // readonly: true Provenance string `json:"provenance,omitempty"` }
EmbeddedContactPoint is the contact point type that is used by grafanas embedded alertmanager implementation. swagger:model
func (*EmbeddedContactPoint) ResourceID ¶
func (e *EmbeddedContactPoint) ResourceID() string
func (*EmbeddedContactPoint) ResourceType ¶
func (e *EmbeddedContactPoint) ResourceType() string
type EvalAlertConditionCommand ¶
type EvalAlertConditionCommand struct { Condition string `json:"condition"` Data []AlertQuery `json:"data"` Now time.Time `json:"now"` }
EvalAlertConditionCommand is the command for evaluating a condition
func (*EvalAlertConditionCommand) UnmarshalJSON ¶
func (cmd *EvalAlertConditionCommand) UnmarshalJSON(b []byte) error
type EvalQueriesPayload ¶
type EvalQueriesPayload struct { Data []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 ( OkErrState ExecutionErrorState = "OK" AlertingErrState ExecutionErrorState = "Alerting" ErrorErrState ExecutionErrorState = "Error" )
type ExportQueryParams ¶
type ExportQueryParams struct { // Whether to initiate a download of the file or not. // in: query // required: false // default: false Download bool `json:"download"` // Format of the downloaded file, either yaml or json. Accept header can also be used, but the query parameter will take precedence. // in: query // required: false // default: yaml Format string `json:"format"` }
swagger:parameters RouteGetAlertRuleGroupExport RouteGetAlertRuleExport RouteGetAlertRulesExport RouteGetContactpointsExport RouteGetContactpointExport
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 FolderUIDPathParam ¶
type FolderUIDPathParam struct { // in:path FolderUID string `json:"FolderUID"` }
swagger:parameters RouteGetAlertRuleGroup RoutePutAlertRuleGroup RouteGetAlertRuleGroupExport
type GetDeleteSilenceParams ¶
type GetDeleteSilenceParams struct { // in:path SilenceId string }
swagger:parameters RouteGetSilence RouteDeleteSilence RouteGetGrafanaSilence RouteDeleteGrafanaSilence
type GetGrafanaAlertStatusesParams ¶
type GetGrafanaAlertStatusesParams struct { // Include Grafana specific labels as part of the response. // in: query // required: false // default: false IncludeInternalLabels bool `json:"includeInternalLabels"` }
swagger:parameters RouteGetGrafanaAlertStatuses
type GetGrafanaRuleStatusesParams ¶
type GetGrafanaRuleStatusesParams struct { // Include Grafana specific labels as part of the response. // in: query // required: false // default: false IncludeInternalLabels bool `json:"includeInternalLabels"` // Filter the list of rules to those that belong to the specified dashboard UID. // in: query // required: false DashboardUID string // Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified. // in: query // required: false PanelID int64 }
swagger:parameters RouteGetGrafanaRuleStatuses
type GetSilencesParams ¶
type GetSilencesParams struct { // in:query Filter []string `json:"filter"` }
swagger:parameters RouteGetSilences RouteGetGrafanaSilences
type GettableAlertmanagers ¶
type GettableAlertmanagers struct { Status string `json:"status"` Data v1.AlertManagersResult `json:"data"` }
swagger:model
type GettableApiAlertingConfig ¶
type GettableApiAlertingConfig struct { Config `yaml:",inline"` MuteTimeProvenances map[string]Provenance `yaml:"muteTimeProvenances,omitempty" json:"muteTimeProvenances,omitempty"` // 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 GettableGrafanaReceiver struct { UID string `json:"uid"` Name string `json:"name"` Type string `json:"type"` DisableResolveMessage bool `json:"disableResolveMessage"` Settings RawMessage `json:"settings,omitempty"` SecureFields map[string]bool `json:"secureFields"` Provenance Provenance `json:"provenance,omitempty"` }
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 []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"` Provenance Provenance `json:"provenance,omitempty" yaml:"provenance,omitempty"` IsPaused bool `json:"is_paused" yaml:"is_paused"` }
swagger:model
type GettableHistoricUserConfig ¶
type GettableHistoricUserConfig struct { ID int64 `yaml:"id" json:"id"` TemplateFiles map[string]string `yaml:"template_files" json:"template_files"` TemplateFileProvenances map[string]Provenance `yaml:"template_file_provenances,omitempty" json:"template_file_provenances,omitempty"` AlertmanagerConfig GettableApiAlertingConfig `yaml:"alertmanager_config" json:"alertmanager_config"` LastApplied *strfmt.DateTime `yaml:"last_applied,omitempty" json:"last_applied,omitempty"` }
type GettableHistoricUserConfigs ¶
type GettableHistoricUserConfigs struct { // in:body Body []GettableHistoricUserConfig }
swagger:response GettableHistoricUserConfigs
type GettableNGalertConfig ¶
type GettableNGalertConfig struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
swagger:model
type GettableRuleGroupConfig ¶
type GettableRuleGroupConfig struct { Name string `yaml:"name" json:"name"` Interval model.Duration `yaml:"interval,omitempty" json:"interval,omitempty"` SourceTenants []string `yaml:"source_tenants,omitempty" json:"source_tenants,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"` TemplateFileProvenances map[string]Provenance `yaml:"template_file_provenances,omitempty" json:"template_file_provenances,omitempty"` 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 HistoricalConfigId ¶
type HistoricalConfigId struct { // Id should be the id of the GettableHistoricUserConfig // in:path Id int64 `json:"id"` }
swagger:parameters RoutePostGrafanaAlertingConfigHistoryActivate
type MuteTimeInterval ¶
type MuteTimeInterval struct { config.MuteTimeInterval `json:",inline" yaml:",inline"` Provenance Provenance `json:"provenance,omitempty"` }
swagger:model
func (*MuteTimeInterval) ResourceID ¶
func (mt *MuteTimeInterval) ResourceID() string
func (*MuteTimeInterval) ResourceType ¶
func (mt *MuteTimeInterval) ResourceType() string
func (*MuteTimeInterval) Validate ¶
func (mt *MuteTimeInterval) Validate() error
type MuteTimingPayload ¶
type MuteTimingPayload struct { // in:body Body MuteTimeInterval }
swagger:parameters RoutePostMuteTiming RoutePutMuteTiming
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 RoutePostNameGrafanaRulesConfig
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 NotificationTemplate ¶
type NotificationTemplate struct { Name string `json:"name"` Template string `json:"template"` Provenance Provenance `json:"provenance,omitempty"` }
swagger:model
func (*NotificationTemplate) ResourceID ¶
func (t *NotificationTemplate) ResourceID() string
func (*NotificationTemplate) ResourceType ¶
func (t *NotificationTemplate) ResourceType() string
func (*NotificationTemplate) Validate ¶
func (t *NotificationTemplate) Validate() error
type NotificationTemplateContent ¶
type NotificationTemplateContent struct {
Template string `json:"template"`
}
type NotificationTemplatePayload ¶
type NotificationTemplatePayload struct { // in:body Body NotificationTemplateContent }
swagger:parameters RoutePutTemplate
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 RouteGetGrafanaRulesConfig
type PathNamespaceConfig ¶
type PathNamespaceConfig struct { // in: path Namespace string }
swagger:parameters RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig RouteGetNamespaceGrafanaRulesConfig RouteDeleteNamespaceGrafanaRulesConfig
type PathRouleGroupConfig ¶
swagger:parameters RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig RouteGetGrafanaRuleGroupConfig RouteDeleteGrafanaRuleGroupConfig
type Policytree ¶
type Policytree struct { // The new notification routing tree to use // in:body Body Route }
swagger:parameters RoutePutPolicyTree
type PostSilencesOKBody ¶
type PostSilencesOKBody struct { // silence ID SilenceID string `json:"silenceID,omitempty"` }
swagger:model postSilencesOKBody
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 PostableExtendedRuleNodeExtended ¶
type PostableExtendedRuleNodeExtended struct { // required: true Rule PostableExtendedRuleNode `json:"rule"` // example: okrd3I0Vz NamespaceUID string `json:"folderUid"` // example: project_x NamespaceTitle string `json:"folderTitle"` // example: eval_group_1 RuleGroup string `json:"ruleGroup"` }
swagger:model
func (*PostableExtendedRuleNodeExtended) UnmarshalJSON ¶
func (n *PostableExtendedRuleNodeExtended) 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 []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"` IsPaused *bool `json:"is_paused" yaml:"is_paused"` }
swagger:model
type PostableNGalertConfig ¶
type PostableNGalertConfig struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
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) AssignMissingConfigUIDs ¶
func (c *PostableUserConfig) AssignMissingConfigUIDs() error
AssignMissingConfigUIDs assigns missing UUIDs to receiver configs.
func (*PostableUserConfig) EncryptConfig ¶
func (c *PostableUserConfig) EncryptConfig(encrypt EncryptFn) error
EncryptConfig parses grafana receivers and encrypts secrets.
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) UnmarshalJSON ¶
func (c *PostableUserConfig) UnmarshalJSON(b []byte) error
func (*PostableUserConfig) UnmarshalYAML ¶
func (c *PostableUserConfig) UnmarshalYAML(value *yaml.Node) error
type Provenance ¶
type Provenance string
type ProvisionedAlertRule ¶
type ProvisionedAlertRule struct { ID int64 `json:"id"` UID string `json:"uid"` // required: true OrgID int64 `json:"orgID"` // required: true // example: project_x FolderUID string `json:"folderUID"` // required: true // minLength: 1 // maxLength: 190 // example: eval_group_1 RuleGroup string `json:"ruleGroup"` // required: true // minLength: 1 // maxLength: 190 // example: Always firing Title string `json:"title"` // required: true // example: A Condition string `json:"condition"` // required: true // example: [{"refId":"A","queryType":"","relativeTimeRange":{"from":0,"to":0},"datasourceUid":"__expr__","model":{"conditions":[{"evaluator":{"params":[0,0],"type":"gt"},"operator":{"type":"and"},"query":{"params":[]},"reducer":{"params":[],"type":"avg"},"type":"query"}],"datasource":{"type":"__expr__","uid":"__expr__"},"expression":"1 == 1","hide":false,"intervalMs":1000,"maxDataPoints":43200,"refId":"A","type":"math"}}] Data []AlertQuery `json:"data"` // readonly: true Updated time.Time `json:"updated,omitempty"` // required: true NoDataState NoDataState `json:"noDataState"` // required: true ExecErrState ExecutionErrorState `json:"execErrState"` // required: true For model.Duration `json:"for"` // example: {"runbook_url": "https://supercoolrunbook.com/page/13"} Annotations map[string]string `json:"annotations,omitempty"` // example: {"team": "sre-team-1"} Labels map[string]string `json:"labels,omitempty"` // readonly: true Provenance Provenance `json:"provenance,omitempty"` // example: false IsPaused bool `json:"isPaused"` }
type RawMessage ¶
type RawMessage json.RawMessage // This type alias adds YAML marshaling to the json.RawMessage.
func (RawMessage) MarshalJSON ¶
func (r RawMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns m as the JSON encoding of m.
func (RawMessage) MarshalYAML ¶
func (r RawMessage) MarshalYAML() (interface{}, error)
func (*RawMessage) UnmarshalJSON ¶
func (r *RawMessage) UnmarshalJSON(data []byte) error
func (*RawMessage) UnmarshalYAML ¶
func (r *RawMessage) UnmarshalYAML(unmarshal func(interface{}) error) error
type ReceiverExport ¶
type ReceiverExport struct { UID string `json:"uid" yaml:"uid"` Type string `json:"type" yaml:"type"` Settings RawMessage `json:"settings" yaml:"settings"` DisableResolveMessage bool `json:"disableResolveMessage" yaml:"disableResolveMessage"` }
ReceiverExport is the provisioned file export of alerting.ReceiverV1.
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) String ¶
func (r ReceiverType) String() string
type ReceiversResponse ¶
swagger:response receiversResponse
type RelativeTimeRange ¶
type RelativeTimeRange struct { From Duration `json:"from" yaml:"from"` To Duration `json:"to" yaml:"to"` }
RelativeTimeRange is the per query start and end time for requests.
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"` Provenance Provenance `yaml:"provenance,omitempty" json:"provenance,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 ¶
AsGrafanaRoute returns a Grafana route from an Alertmanager route. The Matchers are converted to ObjectMatchers.
func (*Route) AsAMRoute ¶
AsAMRoute returns an Alertmanager route from a Grafana route. The ObjectMatchers are converted to Matchers.
func (*Route) ResourceID ¶
func (*Route) ResourceType ¶
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.
func (*Route) Validate ¶
Validate normalizes a Route r, and returns errors if r is an invalid root route. Root routes must satisfy a few additional conditions.
func (*Route) ValidateMuteTimes ¶
func (*Route) ValidateReceivers ¶
type RouteGetGrafanaAlertingConfigHistoryParams ¶
type RouteGetGrafanaAlertingConfigHistoryParams struct { // Limit response to n historic configurations. // in:query Limit int `json:"limit"` }
swagger:parameters RouteGetGrafanaAlertingConfigHistory
type RouteGetMuteTimingParam ¶
type RouteGetMuteTimingParam struct { // Mute timing name // in:path Name string `json:"name"` }
swagger:parameters RouteGetTemplate RouteGetMuteTiming RoutePutMuteTiming stable RouteDeleteMuteTiming
type RouteGetTemplateParam ¶
type RouteGetTemplateParam struct { // Template Name // in:path Name string `json:"name"` }
swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
type Rule ¶
type Rule struct { // required: true Name string `json:"name"` // required: true Query string `json:"query"` Labels overrideLabels `json:"labels,omitempty"` // required: true Health string `json:"health"` LastError string `json:"lastError,omitempty"` // 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"` Totals map[string]int64 `json:"totals,omitempty"` }
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"` Totals map[string]int64 `json:"totals"` // 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 RuleGroupPathParam ¶
type RuleGroupPathParam struct { // in:path Group string `json:"Group"` }
swagger:parameters RouteGetAlertRuleGroup RoutePutAlertRuleGroup RouteGetAlertRuleGroupExport
type RuleGroupsBy ¶
RuleGroupsBy is a function that defines the ordering of Rule Groups.
func (RuleGroupsBy) Sort ¶
func (by RuleGroupsBy) Sort(groups []RuleGroup)
type RuleGroupsSorter ¶
type RuleGroupsSorter struct {
// contains filtered or unexported fields
}
func (RuleGroupsSorter) Len ¶
func (s RuleGroupsSorter) Len() int
func (RuleGroupsSorter) Less ¶
func (s RuleGroupsSorter) Less(i, j int) bool
func (RuleGroupsSorter) Swap ¶
func (s RuleGroupsSorter) Swap(i, j int)
type RuleResponse ¶
type RuleResponse struct { // in: body DiscoveryBase // in: body Data RuleDiscovery `json:"data"` }
swagger:model
type StateByImportance ¶
type StateByImportance int
type StateHistory ¶
swagger:response StateHistory
type TemplateErrorKind ¶
type TemplateErrorKind string
swagger:enum TemplateErrorKind
const ( InvalidTemplate TemplateErrorKind = "invalid_template" ExecutionError TemplateErrorKind = "execution_error" )
type TestGrafanaRuleRequest ¶
type TestGrafanaRuleRequest struct { // in:body Body PostableExtendedRuleNodeExtended }
swagger:parameters RouteTestRuleGrafanaConfig
type TestGrafanaRuleResponse ¶
type TestGrafanaRuleResponse struct { // in:body Body []amv2.PostableAlert }
swagger:response TestGrafanaRuleResponse
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 TestReceiversConfigBodyParams ¶
type TestReceiversConfigBodyParams struct { Alert *TestReceiversConfigAlertParams `yaml:"alert,omitempty" json:"alert,omitempty"` Receivers []*PostableApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"` }
func (*TestReceiversConfigBodyParams) ProcessConfig ¶
func (c *TestReceiversConfigBodyParams) ProcessConfig(encrypt EncryptFn) error
type TestReceiversConfigParams ¶
type TestReceiversConfigParams struct { // in:body Body TestReceiversConfigBodyParams }
swagger:parameters RoutePostTestGrafanaReceivers
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 *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
type TestTemplatesConfigBodyParams ¶
type TestTemplatesConfigBodyParams struct { // Alerts to use as data when testing the template. Alerts []*amv2.PostableAlert `json:"alerts"` // Template string to test. Template string `json:"template"` // Name of the template file. Name string `json:"name"` }
type TestTemplatesConfigParams ¶
type TestTemplatesConfigParams struct { // in:body Body TestTemplatesConfigBodyParams }
swagger:parameters RoutePostTestGrafanaTemplates
type TestTemplatesErrorResult ¶
type TestTemplatesErrorResult struct { // Name of the associated template for this error. Will be empty if the Kind is "invalid_template". Name string `json:"name,omitempty"` // Kind of template error that occurred. Kind TemplateErrorKind `json:"kind"` // Error message. Message string `json:"message"` }
type TestTemplatesResult ¶
type TestTemplatesResults ¶
type TestTemplatesResults struct { Results []TestTemplatesResult `json:"results,omitempty"` Errors []TestTemplatesErrorResult `json:"errors,omitempty"` }
swagger:model
type ValidationError ¶
type ValidationError struct { // example: error message Msg string `json:"msg"` }
swagger:model