Alerting: Implement /status for the notification system (#33227)
* Alerting: Implement /status for the notification system Implements the necessary plumbing to have a /status endpoint on the notification system. * Add API examples * Update API specs * Update prometheus/common dependency Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
283572fcbc
commit
f7ed35336d
@@ -57,10 +57,10 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"AlertGroup": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
"AlertGroup": {},
|
||||
"AlertGroups": {
|
||||
"$ref": "#/definitions/alertGroups"
|
||||
},
|
||||
"AlertGroups": {},
|
||||
"AlertInstancesResponse": {
|
||||
"properties": {
|
||||
"instances": {
|
||||
@@ -79,65 +79,6 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"AlertNotification": {
|
||||
"properties": {
|
||||
"created": {
|
||||
"format": "date-time",
|
||||
"type": "string",
|
||||
"x-go-name": "Created"
|
||||
},
|
||||
"disableResolveMessage": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"frequency": {
|
||||
"$ref": "#/definitions/Duration",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"format": "int64",
|
||||
"type": "integer",
|
||||
"x-go-name": "Id"
|
||||
},
|
||||
"isDefault": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "IsDefault"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"secureFields": {
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-name": "SecureFields"
|
||||
},
|
||||
"sendReminder": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "SendReminder"
|
||||
},
|
||||
"settings": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "Uid"
|
||||
},
|
||||
"updated": {
|
||||
"format": "date-time",
|
||||
"type": "string",
|
||||
"x-go-name": "Updated"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
|
||||
},
|
||||
"AlertQuery": {
|
||||
"properties": {
|
||||
"datasourceUid": {
|
||||
@@ -296,14 +237,16 @@
|
||||
},
|
||||
"Authorization": {
|
||||
"properties": {
|
||||
"Credentials": {
|
||||
"credentials": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
},
|
||||
"CredentialsFile": {
|
||||
"type": "string"
|
||||
"credentials_file": {
|
||||
"type": "string",
|
||||
"x-go-name": "CredentialsFile"
|
||||
},
|
||||
"Type": {
|
||||
"type": "string"
|
||||
"type": {
|
||||
"type": "string",
|
||||
"x-go-name": "Type"
|
||||
}
|
||||
},
|
||||
"title": "Authorization contains HTTP authorization credentials.",
|
||||
@@ -312,14 +255,16 @@
|
||||
},
|
||||
"BasicAuth": {
|
||||
"properties": {
|
||||
"Password": {
|
||||
"password": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
},
|
||||
"PasswordFile": {
|
||||
"type": "string"
|
||||
"password_file": {
|
||||
"type": "string",
|
||||
"x-go-name": "PasswordFile"
|
||||
},
|
||||
"Username": {
|
||||
"type": "string"
|
||||
"username": {
|
||||
"type": "string",
|
||||
"x-go-name": "Username"
|
||||
}
|
||||
},
|
||||
"title": "BasicAuth contains basic HTTP authentication credentials.",
|
||||
@@ -338,13 +283,6 @@
|
||||
"type": "array",
|
||||
"x-go-name": "InhibitRules"
|
||||
},
|
||||
"receivers": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/Receiver"
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "Receivers"
|
||||
},
|
||||
"route": {
|
||||
"$ref": "#/definitions/Route"
|
||||
},
|
||||
@@ -360,53 +298,6 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"CreateAlertNotificationCommand": {
|
||||
"properties": {
|
||||
"Result": {
|
||||
"$ref": "#/definitions/AlertNotification"
|
||||
},
|
||||
"disableResolveMessage": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"frequency": {
|
||||
"type": "string",
|
||||
"x-go-name": "Frequency"
|
||||
},
|
||||
"isDefault": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "IsDefault"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"secureSettings": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-name": "SecureSettings"
|
||||
},
|
||||
"sendReminder": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "SendReminder"
|
||||
},
|
||||
"settings": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "Uid"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
},
|
||||
"DateTime": {
|
||||
"description": "DateTime is a time but it serializes to ISO8601 format with millis\nIt knows how to read 3 different variations of a RFC3339 date time.\nMost APIs we encounter want either millisecond or second precision times.\nThis just tries to make it worry-free.",
|
||||
"format": "date-time",
|
||||
@@ -584,8 +475,12 @@
|
||||
"Failure": {
|
||||
"$ref": "#/definitions/ResponseDetails"
|
||||
},
|
||||
"GettableAlert": {},
|
||||
"GettableAlerts": {},
|
||||
"GettableAlert": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"GettableAlerts": {
|
||||
"$ref": "#/definitions/gettableAlerts"
|
||||
},
|
||||
"GettableApiAlertingConfig": {
|
||||
"properties": {
|
||||
"global": {
|
||||
@@ -733,7 +628,36 @@
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"GettableGrafanaReceiver": {
|
||||
"$ref": "#/definitions/AlertNotification"
|
||||
"properties": {
|
||||
"disableResolveMessage": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"secureFields": {
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-name": "SecureFields"
|
||||
},
|
||||
"settings": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"GettableGrafanaReceivers": {
|
||||
"properties": {
|
||||
@@ -763,8 +687,7 @@
|
||||
},
|
||||
"exec_err_state": {
|
||||
"enum": [
|
||||
"Alerting",
|
||||
"KeepLastState"
|
||||
"Alerting"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-name": "ExecErrState"
|
||||
@@ -792,7 +715,6 @@
|
||||
"enum": [
|
||||
"Alerting",
|
||||
"NoData",
|
||||
"KeepLastState",
|
||||
"OK"
|
||||
],
|
||||
"type": "string",
|
||||
@@ -852,7 +774,36 @@
|
||||
"GettableSilence": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
},
|
||||
"GettableSilences": {},
|
||||
"GettableSilences": {
|
||||
"$ref": "#/definitions/gettableSilences"
|
||||
},
|
||||
"GettableStatus": {
|
||||
"properties": {
|
||||
"cluster": {
|
||||
"$ref": "#/definitions/clusterStatus"
|
||||
},
|
||||
"config": {
|
||||
"$ref": "#/definitions/PostableApiAlertingConfig"
|
||||
},
|
||||
"uptime": {
|
||||
"description": "uptime",
|
||||
"format": "date-time",
|
||||
"type": "string",
|
||||
"x-go-name": "Uptime"
|
||||
},
|
||||
"versionInfo": {
|
||||
"$ref": "#/definitions/versionInfo"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"cluster",
|
||||
"config",
|
||||
"uptime",
|
||||
"versionInfo"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"GettableUserConfig": {
|
||||
"properties": {
|
||||
"alertmanager_config": {
|
||||
@@ -945,30 +896,32 @@
|
||||
},
|
||||
"HTTPClientConfig": {
|
||||
"properties": {
|
||||
"Authorization": {
|
||||
"authorization": {
|
||||
"$ref": "#/definitions/Authorization"
|
||||
},
|
||||
"BasicAuth": {
|
||||
"basic_auth": {
|
||||
"$ref": "#/definitions/BasicAuth"
|
||||
},
|
||||
"BearerToken": {
|
||||
"bearer_token": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
},
|
||||
"BearerTokenFile": {
|
||||
"bearer_token_file": {
|
||||
"description": "The bearer token file for the targets. Deprecated in favour of\nAuthorization.CredentialsFile.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"x-go-name": "BearerTokenFile"
|
||||
},
|
||||
"FollowRedirects": {
|
||||
"follow_redirects": {
|
||||
"description": "FollowRedirects specifies whether the client should follow HTTP 3xx redirects.\nThe omitempty flag is not set, because it would be hidden from the\nmarshalled configuration when set to false.",
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"x-go-name": "FollowRedirects"
|
||||
},
|
||||
"OAuth2": {
|
||||
"oauth2": {
|
||||
"$ref": "#/definitions/OAuth2"
|
||||
},
|
||||
"ProxyURL": {
|
||||
"proxy_url": {
|
||||
"$ref": "#/definitions/URL"
|
||||
},
|
||||
"TLSConfig": {
|
||||
"tls_config": {
|
||||
"$ref": "#/definitions/TLSConfig"
|
||||
}
|
||||
},
|
||||
@@ -1123,29 +1076,34 @@
|
||||
},
|
||||
"OAuth2": {
|
||||
"properties": {
|
||||
"ClientID": {
|
||||
"type": "string"
|
||||
"client_id": {
|
||||
"type": "string",
|
||||
"x-go-name": "ClientID"
|
||||
},
|
||||
"ClientSecret": {
|
||||
"client_secret": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
},
|
||||
"ClientSecretFile": {
|
||||
"type": "string"
|
||||
"client_secret_file": {
|
||||
"type": "string",
|
||||
"x-go-name": "ClientSecretFile"
|
||||
},
|
||||
"EndpointParams": {
|
||||
"endpoint_params": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "EndpointParams"
|
||||
},
|
||||
"Scopes": {
|
||||
"scopes": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
"type": "array",
|
||||
"x-go-name": "Scopes"
|
||||
},
|
||||
"TokenURL": {
|
||||
"type": "string"
|
||||
"token_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "TokenURL"
|
||||
}
|
||||
},
|
||||
"title": "OAuth2 is the oauth2 client configuration.",
|
||||
@@ -1502,7 +1460,36 @@
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"PostableGrafanaReceiver": {
|
||||
"$ref": "#/definitions/CreateAlertNotificationCommand"
|
||||
"properties": {
|
||||
"disableResolveMessage": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"secureSettings": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-name": "SecureSettings"
|
||||
},
|
||||
"settings": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"PostableGrafanaReceivers": {
|
||||
"properties": {
|
||||
@@ -1532,8 +1519,7 @@
|
||||
},
|
||||
"exec_err_state": {
|
||||
"enum": [
|
||||
"Alerting",
|
||||
"KeepLastState"
|
||||
"Alerting"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-name": "ExecErrState"
|
||||
@@ -1542,7 +1528,6 @@
|
||||
"enum": [
|
||||
"Alerting",
|
||||
"NoData",
|
||||
"KeepLastState",
|
||||
"OK"
|
||||
],
|
||||
"type": "string",
|
||||
@@ -1651,7 +1636,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/config"
|
||||
},
|
||||
"Receiver": {
|
||||
"$ref": "#/definitions/receiver",
|
||||
"properties": {
|
||||
"email_configs": {
|
||||
"items": {
|
||||
@@ -1985,18 +1969,6 @@
|
||||
"$ref": "#/definitions/URL",
|
||||
"title": "SecretURL is a URL that must not be revealed on marshaling."
|
||||
},
|
||||
"SecureJsonData": {
|
||||
"additionalProperties": {
|
||||
"items": {
|
||||
"format": "uint8",
|
||||
"type": "integer"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"description": "SecureJsonData is used to store encrypted data (for example in data_source table). Only values are separately\nencrypted.",
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/components/securejsondata"
|
||||
},
|
||||
"SlackAction": {
|
||||
"description": "See https://api.slack.com/docs/message-attachments#action_fields and https://api.slack.com/docs/message-buttons\nfor more information.",
|
||||
"properties": {
|
||||
@@ -2190,25 +2162,30 @@
|
||||
},
|
||||
"TLSConfig": {
|
||||
"properties": {
|
||||
"CAFile": {
|
||||
"ca_file": {
|
||||
"description": "The CA cert to use for the targets.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"x-go-name": "CAFile"
|
||||
},
|
||||
"CertFile": {
|
||||
"cert_file": {
|
||||
"description": "The client cert file for the targets.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"x-go-name": "CertFile"
|
||||
},
|
||||
"InsecureSkipVerify": {
|
||||
"insecure_skip_verify": {
|
||||
"description": "Disable target certificate validation.",
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"x-go-name": "InsecureSkipVerify"
|
||||
},
|
||||
"KeyFile": {
|
||||
"key_file": {
|
||||
"description": "The client key file for the targets.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"x-go-name": "KeyFile"
|
||||
},
|
||||
"ServerName": {
|
||||
"server_name": {
|
||||
"description": "Used to verify the hostname for the targets.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"x-go-name": "ServerName"
|
||||
}
|
||||
},
|
||||
"title": "TLSConfig configures the options for TLS connections.",
|
||||
@@ -2624,7 +2601,7 @@
|
||||
"receivers": {
|
||||
"description": "receivers",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Receiver"
|
||||
"$ref": "#/definitions/receiver"
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "Receivers"
|
||||
@@ -2662,7 +2639,7 @@
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
"$ref": "#/definitions/GettableAlert"
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "GettableAlerts",
|
||||
@@ -3341,7 +3318,7 @@
|
||||
"in": "body",
|
||||
"name": "Silence",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/PostableSilence"
|
||||
"$ref": "#/definitions/postableSilence"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3371,6 +3348,38 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/status": {
|
||||
"get": {
|
||||
"description": "get alertmanager status and configuration",
|
||||
"operationId": "RouteGetAMStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "GettableStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GettableStatus"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts": {
|
||||
"delete": {
|
||||
"description": "deletes the Alerting config for a tenant",
|
||||
|
||||
Reference in New Issue
Block a user