Alerting: Empty endpoints to manage alertmanager configurations (#106546)

This commit is contained in:
Alexander Akhmetov
2025-06-11 13:45:02 +02:00
committed by GitHub
parent c611021d7d
commit eaac4a69fb
10 changed files with 463 additions and 72 deletions
+114 -14
View File
@@ -1361,17 +1361,65 @@
}
},
"/convert/api/v1/alerts": {
"get": {
"description": "Returns a specific imported Alertmanager configuration by its identifier.",
"produces": [
"application/yaml"
],
"tags": [
"convert_prometheus"
],
"summary": "Get extra Alertmanager configuration from Grafana.",
"operationId": "RouteConvertPrometheusGetAlertmanagerConfig",
"parameters": [
{
"type": "string",
"description": "Unique identifier for the Alertmanager configuration to retrieve.",
"name": "x-grafana-alerting-config-identifier",
"in": "header"
}
],
"responses": {
"200": {
"description": "GettableAlertmanagerUserConfig",
"schema": {
"$ref": "#/definitions/GettableAlertmanagerUserConfig"
}
},
"403": {
"description": "ForbiddenError",
"schema": {
"$ref": "#/definitions/ForbiddenError"
}
}
}
},
"post": {
"description": "This endpoint allows importing Alertmanager configurations to Grafana. Each configuration is identified by\na unique identifier and can include merge matchers to select which alerts should be handled by\nthis specific configuration.",
"produces": [
"application/json"
],
"tags": [
"convert_prometheus"
],
"summary": "Load Alertmanager configuration to Grafana and merge it with the existing configuration.",
"summary": "Load extra Alertmanager configuration to Grafana and merge it with the existing configuration.",
"operationId": "RouteConvertPrometheusPostAlertmanagerConfig",
"parameters": [
{
"type": "string",
"description": "Unique identifier for this Alertmanager configuration.\nThis identifier is used to distinguish between different imported configurations.",
"name": "x-grafana-alerting-config-identifier",
"in": "header"
},
{
"type": "string",
"example": "'environment=production,team=backend' will only apply this",
"description": "Comma-separated list of label matchers in 'key=value' format.\nThese matchers determine which alerts this configuration should handle.",
"name": "x-grafana-alerting-merge-matchers",
"in": "header"
},
{
"description": "Alertmanager configuration including routing rules, receivers, and template files",
"name": "Body",
"in": "body",
"schema": {
@@ -1394,6 +1442,39 @@
}
},
"x-raw-request": "true"
},
"delete": {
"description": "The main Grafana Alertmanager configuration remains unaffected.",
"produces": [
"application/json"
],
"tags": [
"convert_prometheus"
],
"summary": "Delete extra Alertmanager configuration from Grafana by its identifier.",
"operationId": "RouteConvertPrometheusDeleteAlertmanagerConfig",
"parameters": [
{
"type": "string",
"description": "Unique identifier for the Alertmanager configuration to delete.",
"name": "x-grafana-alerting-config-identifier",
"in": "header"
}
],
"responses": {
"202": {
"description": "ConvertPrometheusResponse",
"schema": {
"$ref": "#/definitions/ConvertPrometheusResponse"
}
},
"403": {
"description": "ForbiddenError",
"schema": {
"$ref": "#/definitions/ForbiddenError"
}
}
}
}
},
"/convert/prometheus/config/v1/rules": {
@@ -4788,6 +4869,12 @@
"properties": {
"alertmanager_config": {
"$ref": "#/definitions/Config"
},
"template_files": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
@@ -5616,6 +5703,20 @@
"$ref": "#/definitions/Frame"
}
},
"GettableAlertmanagerUserConfig": {
"type": "object",
"properties": {
"alertmanager_config": {
"type": "string"
},
"template_files": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"GettableAlertmanagers": {
"type": "object",
"properties": {
@@ -6247,7 +6348,11 @@
"type": "object",
"properties": {
"equal": {
"$ref": "#/definitions/LabelNames"
"description": "A set of labels that must be equal between the source and target alert\nfor them to be a match.",
"type": "array",
"items": {
"type": "string"
}
},
"source_match": {
"description": "SourceMatch defines a set of labels that have to equal the given\nvalue for source alerts. Deprecated. Remove before v1.0 release.",
@@ -6370,17 +6475,6 @@
}
}
},
"LabelName": {
"description": "A LabelName is a key for a LabelSet or Metric. It has a value associated\ntherewith.",
"type": "string"
},
"LabelNames": {
"type": "array",
"title": "LabelNames is a sortable LabelName slice. In implements sort.Interface.",
"items": {
"$ref": "#/definitions/LabelName"
}
},
"LabelSet": {
"description": "A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet\nmay be fully-qualified down to the point where it may resolve to a single\nMetric in the data store or not. All operations that occur within the realm\nof a LabelSet can emit a vector of Metric entities to which the LabelSet may\nmatch.",
"type": "object",
@@ -7883,8 +7977,8 @@
}
},
"Route": {
"description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.",
"type": "object",
"title": "A Route is a node that contains definitions of how to handle alerts.",
"properties": {
"active_time_intervals": {
"type": "array",
@@ -7926,6 +8020,12 @@
"type": "string"
}
},
"object_matchers": {
"$ref": "#/definitions/ObjectMatchers"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"receiver": {
"type": "string"
},