Alerting: send alerts to external, internal, or both alertmanagers (#40341)
* (WIP) send alerts to external, internal, or both alertmanagers * Modify admin configuration endpoint, update swagger docs * Integration test for admin config updated * Code review changes * Fix alertmanagers choice not changing bug, add unit test * Add AlertmanagersChoice as enum in swagger, code review changes * Fix API and tests errors * Change enum from int to string, use 'SendAlertsTo' instead of 'AlertmanagerChoice' where necessary * Fix tests to reflect last changes * Keep senders running when alerts are handled just internally * Check if any external AM has been discovered before sending alerts, update tests * remove duplicate data from logs * update comment * represent alertmanagers choice as an int instead of a string * default alertmanagers choice to all alertmanagers, test cases * update definitions and generate spec
This commit is contained in:
@@ -769,6 +769,7 @@
|
||||
"Alerting"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "Alerting AlertingErrState",
|
||||
"x-go-name": "ExecErrState"
|
||||
},
|
||||
"id": {
|
||||
@@ -797,6 +798,7 @@
|
||||
"OK"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "Alerting Alerting\nNoData NoData\nOK OK",
|
||||
"x-go-name": "NoDataState"
|
||||
},
|
||||
"orgId": {
|
||||
@@ -838,6 +840,16 @@
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "Alertmanagers"
|
||||
},
|
||||
"alertmanagersChoice": {
|
||||
"enum": [
|
||||
"all",
|
||||
"internal",
|
||||
"external"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "all AllAlertmanagers\ninternal InternalAlertmanager\nexternal ExternalAlertmanagers",
|
||||
"x-go-name": "AlertmanagersChoice"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
@@ -1718,6 +1730,7 @@
|
||||
"Alerting"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "Alerting AlertingErrState",
|
||||
"x-go-name": "ExecErrState"
|
||||
},
|
||||
"no_data_state": {
|
||||
@@ -1727,6 +1740,7 @@
|
||||
"OK"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "Alerting Alerting\nNoData NoData\nOK OK",
|
||||
"x-go-name": "NoDataState"
|
||||
},
|
||||
"title": {
|
||||
@@ -1749,6 +1763,16 @@
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "Alertmanagers"
|
||||
},
|
||||
"alertmanagersChoice": {
|
||||
"enum": [
|
||||
"all",
|
||||
"internal",
|
||||
"external"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "all AllAlertmanagers\ninternal InternalAlertmanager\nexternal ExternalAlertmanagers",
|
||||
"x-go-name": "AlertmanagersChoice"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
@@ -2884,6 +2908,7 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"properties": {
|
||||
"alerts": {
|
||||
"description": "alerts",
|
||||
@@ -2905,16 +2930,15 @@
|
||||
"labels",
|
||||
"receiver"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"type": "array"
|
||||
"type": "array",
|
||||
"x-go-name": "AlertGroups",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertStatus": {
|
||||
"description": "AlertStatus alert status",
|
||||
@@ -3096,13 +3120,15 @@
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"type": "array"
|
||||
"type": "array",
|
||||
"x-go-name": "GettableAlerts",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@@ -3154,9 +3180,7 @@
|
||||
"status",
|
||||
"updatedAt"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-name": "GettableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "object"
|
||||
},
|
||||
"gettableSilences": {
|
||||
"description": "GettableSilences gettable silences",
|
||||
@@ -3335,6 +3359,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name",
|
||||
@@ -3345,9 +3370,7 @@
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-name": "Receiver",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "object"
|
||||
},
|
||||
"silence": {
|
||||
"description": "Silence silence",
|
||||
@@ -3456,8 +3479,8 @@
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"description": "Package definitions includes the types required for generating or consuming an OpenAPI\nspec for the Grafana 8 Alerts API.",
|
||||
"title": "Grafana 8 Alerts API.",
|
||||
"description": "Package definitions includes the types required for generating or consuming an OpenAPI\nspec for the Grafana Alerting API.",
|
||||
"title": "Grafana Alerting API.",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"paths": {
|
||||
@@ -4400,7 +4423,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Creates or updates the NGalert configuration of the user's organization.",
|
||||
"summary": "Creates or updates the NGalert configuration of the user's organization. If no value is sent for alertmanagersChoice, it defaults to \"all\".",
|
||||
"tags": [
|
||||
"configuration"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user