HTTP Status Code: 403 MissingParameter
A required parameter for the specified action is not supplied.
HTTP Status Code: 400 NotAuthorized
You do not have permission to perform this action.
HTTP Status Code: 400 OptInRequired
The AWS access key ID needs a subscription for the service.
HTTP Status Code: 403 RequestExpired
The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for presigned URLs), or the date stamp on the request is more than 15 minutes in the future.
HTTP Status Code: 400 ServiceUnavailable
The request has failed due to a temporary failure of the server.
HTTP Status Code: 503 ThrottlingException
The request was denied due to request throttling.
HTTP Status Code: 400 ValidationError
The input fails to satisfy the constraints specified by an AWS service.
HTTP Status Code: 400
Prometheus-compatible APIs
Amazon Managed Service for Prometheus supports the following Prometheus-compatible APIs.
Topics
• CreateAlertManagerAlerts (p. 117)
• DeleteAlertManagerSilence (p. 118)
• GetAlertManagerStatus (p. 118)
• GetAlertManagerSilence (p. 119)
• GetLabels (p. 120)
• GetMetricMetadata (p. 122)
• GetSeries (p. 123)
• ListAlerts (p. 124)
• ListAlertManagerAlerts (p. 125)
CreateAlertManagerAlerts
• ListAlertManagerAlertGroups (p. 126)
• ListAlertManagerReceivers (p. 127)
• ListAlertManagerSilences (p. 128)
• ListRules (p. 129)
• PutAlertManagerSilences (p. 130)
• QueryMetrics (p. 131)
• RemoteWrite (p. 132)
CreateAlertManagerAlerts
The CreateAlertManagerAlerts operation creates an alert in the workspace.
Valid HTTP verbs:
POST Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/alerts URL query parameters:
alerts An array of objects, where each object represents one alert. The following is an example of an alert object:
[
{ "startsAt": "2021-09-24T17:14:04.995Z", "endsAt": "2021-09-24T17:14:04.995Z", "annotations": {
"additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string"
},
"labels": {
"additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string"
},
"generatorURL": "string"
} ]
Sample request
POST /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/alerts HTTP/1.1
Content-Length: 203, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0 [ {
"labels": {
"alertname": "test-alert"
},
"annotations": {
"summary": "this is a test alert used for demo purposes"
DeleteAlertManagerSilence
},
"generatorURL": "https://www.amazon.com/"
}]
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 0
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
DeleteAlertManagerSilence
The DeleteSilence deletes one alert silence.
Valid HTTP verbs:
DELETE Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/silence/silenceID URL query parameters: none
Sample request
DELETE /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/silence/
d29d9df3-9125-4441-912c-70b05f86f973 HTTP/1.1 Content-Length: 0,
Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 0
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
GetAlertManagerStatus
The GetAlertManagerStatus retrieves information about the status of alert manager.
Valid HTTP verbs:
GET
GetAlertManagerSilence
Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/status URL query parameters: none
Sample request
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/status HTTP/1.1 Content-Length: 0,
Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 941
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin {
"cluster": null, "config": {
"original": "global:\n resolve_timeout: 5m\n http_config:\n follow_redirects:
true\n smtp_hello: localhost\n smtp_require_tls: true\nroute:\n receiver: sns-0\n group_by:\n - label\n continue: false\nreceivers:\n- name: sns-0\n sns_configs:\n - send_resolved: false\n http_config:\n follow_redirects: true\n sigv4:
{}\n topic_arn: arn:aws:sns:us-west-2:123456789012:test\n subject: '{{ template \"sns.default.subject\" . }}'\n message: '{{ template \"sns.default.message\" . }}'\n workspace_arn: arn:aws:aps:us-west-2:123456789012:workspace/ws-58a6a446-5ec4-415b-9052-a449073bbd0a\ntemplates: []\n"
},
"uptime": null, "versionInfo": null }
GetAlertManagerSilence
The GetAlertManagerSilence retrieves information about one alert silence.
Valid HTTP verbs:
GET Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/silence/silenceID URL query parameters: none
Sample request
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/silence/
d29d9df3-9125-4441-912c-70b05f86f973 HTTP/1.1
GetLabels
Content-Length: 0, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 310
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
{ "id": "d29d9df3-9125-4441-912c-70b05f86f973", "status": {
"state": "active"
},
"updatedAt": "2021-10-22T19:32:11.763Z", "comment": "hello-world",
"createdBy": "test-person",
"endsAt": "2023-07-24T01:05:36.000Z", "matchers": [
{
"isEqual": true, "isRegex": true, "name": "job", "value": "hello"
} ],
"startsAt": "2021-10-22T19:32:11.763Z"
}
GetLabels
The GetLabels operation retrieves the labels associated with a time series.
Valid HTTP verbs:
GET, POST Valid URIs:
/workspaces/workspaceId/api/v1/labels
/workspaces/workspaceId/api/v1/label/label-name/values This URI supports only GET requests.
URL query parameters:
match[]=<series_selector> Repeated series selector argument that selects the series from which to read the label names. Optional.
start=<rfc3339 | unix_timestamp> Start timestamp. Optional.
end=<rfc3339 | unix_timestamp> End timestamp. Optional.
Sample request for /workspaces/workspaceId/api/v1/labels
GetLabels
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin {
"status": "success", "data": [
"app_kubernetes_io_instance", "app_kubernetes_io_managed_by", "app_kubernetes_io_name", "area",
"beta_kubernetes_io_arch",
"beta_kubernetes_io_instance_type", "beta_kubernetes_io_os",
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
GetMetricMetadata
{ "status": "success", "data": [
"ReadWriteOnce"
] }
GetMetricMetadata
The GetMetricMetadata operation retrieves metadata about metrics that are currently being scraped from targets. It does not provide any target information.
The data section of the query result consists of an object where each key is a metric name and each value is a list of unique metadata objects, as exposed for that metric name across all targets.
Valid HTTP verbs:
GET Valid URIs:
/workspaces/workspaceId/api/v1/metadata URL query parameters:
limit=<number> The maximum number of metrics to return.
metric=<string> A metric name to filter metadata for. If you keep this empty, all metric metadata is retrieved.
Sample request
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/metadata HTTP/1.1 Content-Length: 0,
Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
Transfer-Encoding: chunked { "status": "success", "data": {
"aggregator_openapi_v2_regeneration_count": [ {
"type": "counter",
"help": "[ALPHA] Counter of OpenAPI v2 spec regeneration count broken down by causing APIService name and reason.",
"unit": ""
} ], ...
GetSeries
} }
GetSeries
The GetSeries operation retrieves list of time series that match a certain label set.
Valid HTTP verbs:
GET, POST Valid URIs:
/workspaces/workspaceId/api/v1/series URL query parameters:
match[]=<series_selector> Repeated series selector argument that selects the series to return.
At least one match[] argument must be provided.
start=<rfc3339 | unix_timestamp> Start timestamp. Optional end=<rfc3339 | unix_timestamp> End timestamp. Optional
Sample request
POST /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/series --data-urlencode 'match[]=node_cpu_seconds_total{app="prometheus"}' data-urlencode 'start=1634936400' --data-urlencode 'end=1634939100' HTTP/1.1
Content-Length: 0, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
content-encoding: gzip {
"status": "success", "data": [
{
"__name__": "node_cpu_seconds_total", "app": "prometheus",
"app_kubernetes_io_managed_by": "Helm", "chart": "prometheus-11.12.1",
"cluster": "cluster-1", "component": "node-exporter", "cpu": "0",
"heritage": "Helm",
"instance": "10.0.100.36:9100", "job": "kubernetes-service-endpoints",
"kubernetes_name": "servicesstackprometheuscf14a6d7-node-exporter", "kubernetes_namespace": "default",
"kubernetes_node": "ip-10-0-100-36.us-west-2.compute.internal", "mode": "idle",
ListAlerts
"release": "servicesstackprometheuscf14a6d7"
},
"kubernetes_name": "servicesstackprometheuscf14a6d7-node-exporter", "kubernetes_namespace": "default",
"kubernetes_node": "ip-10-0-100-36.us-west-2.compute.internal", "mode": "iowait",
"release": "servicesstackprometheuscf14a6d7"
}, ...
] }
ListAlerts
The ListAlerts operation retrieves currently active alerts in the workspace.
Valid HTTP verbs:
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
{ "status": "success", "data": {
"alerts": [ {
"labels": {
"alertname": "test-1.alert",
ListAlertManagerAlerts
"activeAt": "2020-12-01T19:37:25.429565909Z", "value": "1e+00"
The ListAlertManagerAlerts retrieves information about the alerts currently firing in alert manager in the workspace.
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json
"endsAt": "2021-10-21T22:07:31.501Z", "fingerprint": "375eab7b59892505", "receivers": [
{
"name": "sns-0"
} ],
"startsAt": "2021-10-21T22:02:31.501Z", "status": {
ListAlertManagerAlertGroups
"inhibitedBy": [], "silencedBy": [], "state": "active"
},
"updatedAt": "2021-10-21T22:02:31.501Z", "labels": {
"alertname": "test-alert"
} } ]
ListAlertManagerAlertGroups
The ListAlertManagerAlertGroups operation retrieves a list of alert groups configured in alert manager in the workspace.
Valid HTTP verbs:
GET Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/alerts/groups URL query parameters:
active Boolean. If true, the returned list includes active alerts. The default is true. Optional silenced Boolean. If true, the returned list includes silenced alerts. The default is true. Optional inhibited Boolean. If true, the returned list includes inhibited alerts. The default is true. Optional filter An array of strings. A list of matchers to filter alerts by. Optional
receiver String. A regular expression matching receivers to filter alerts by. Optional
Sample request
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/alerts/groups HTTP/1.1
Content-Length: 0, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 443
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin [ {
"alerts": [ {
"annotations": {
ListAlertManagerReceivers
The ListAlertManagerReceivers operation retrieves information about the receivers configured in alert manager.
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json
ListAlertManagerSilences
Server: amazon vary: Origin [
{
"name": "sns-0"
} ]
ListAlertManagerSilences
The ListAlertManagerSilences operation retrieves information about the alert silences configured in the workspace.
Valid HTTP verbs:
GET Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/silences
Sample request
GET /workspaces/ws-58a6a446-5ec4-415b-9052-a449073bbd0a/alertmanager/api/v2/silences HTTP/1.1
Content-Length: 0, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 312
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin [ {
"id": "d29d9df3-9125-4441-912c-70b05f86f973", "status": {
"state": "active"
},
"updatedAt": "2021-10-22T19:32:11.763Z", "comment": "hello-world",
"createdBy": "test-person",
"endsAt": "2023-07-24T01:05:36.000Z", "matchers": [
{
"isEqual": true, "isRegex": true, "name": "job", "value": "hello"
} ],
"startsAt": "2021-10-22T19:32:11.763Z"
ListRules
} ]
ListRules
The ListRules retrieves information about the rules configured in the workspace.
Valid HTTP verbs:
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin
{ "status": "success", "data": {
PutAlertManagerSilences
}
PutAlertManagerSilences
The PutAlertManagerSilences operation creates a new alert silence or updates an existing one.
Valid HTTP verbs:
POST Valid URIs:
/workspaces/workspaceId/alertmanager/api/v2/silences URL query parameters:
silence An object that represents the silence. The following is an example:
{ "id": "string", "matchers": [ {
"name": "string", "value": "string", "isRegex": true, "isEqual": true }
], "startsAt": "2021-09-23T17:01:53.269Z", "endsAt": "2021-09-24T17:01:53.269Z", "createdBy": "string",
"comment": "string"
}
Sample request
POST /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/silences HTTP/1.1
Content-Length: 281, Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0 { "matchers":[
{
"name":"job", "value":"hello", "isRegex":false, "isRegex":true }
],
"startsAt":"2020-07-23T01:05:36+00:00", "endsAt":"2023-07-24T01:05:36+00:00", "createdBy":"test-person",
"comment":"hello-world"
}
Sample response
HTTP/1.1 200 OK
QueryMetrics
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 53
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin {
"silenceID": "512860da-74f3-43c9-8833-cec026542b32"
}
QueryMetrics
The QueryMetrics operation evaluates an instant query at a single point in time or over a range of time.
Valid HTTP verbs:
GET, POST Valid URIs:
/workspaces/workspaceId/api/v1/query This URI evaluates an instant query at a single point in time.
/workspaces/workspaceId/api/v1/query_range This URI evaluates an instant query over a range of time.
URL query parameters:
query=<string> A Prometheus expression query string. Used in both query and query_range.
time=<rfc3339 | unix_timestamp> (Optional) Evaluation timestamp if you are using the query for an instant query at a single point in time.
timeout=<duration> (Optional) Evaluation timeout. Defaults to and is capped by the value of the -query.timeout flag. Used in both query and query_range.
start=<rfc3339 | unix_timestamp> Start timestamp if you are using query_range to query for a range of time.
end=<rfc3339 | unix_timestamp> End timestamp if you are using query_range to query for a range of time.
step=<duration | float> Query resolution step width in duration format or as a float number of seconds. Use only if you are using query_range to query for a range of time, and required for such queries.
Duration
A duration in a Prometheus-compatible API is a number, followed immediately by one of the following units:
• ms milliseconds
• s seconds
• m minutes
• h hours
• d days, assuming a day always has 24h
RemoteWrite
• w weeks, assuming a week always has 7d
• y years, assuming a year always has 365d
Sample request
POST /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/query?
query=sum(node_cpu_seconds_total) HTTP/1.1 Content-Length: 0,
Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Grafana/8.1.0
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length: 132
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
content-encoding: gzip {
"status": "success", "data": {
"resultType": "vector", "result": [
{
"metric": {}, "value": [
1634937046.322, "252590622.81000024"
] } ] } }
RemoteWrite
The RemoteWrite operation writes metrics from a Prometheus server to a remote URL in a standardized format. Typically, you will use an existing client such as a Prometheus server to call this operation.
Valid HTTP verbs:
POST Valid URIs:
/workspaces/workspaceId/api/v1/remote_write URL query parameters:
None
RemoteWrite has an ingestion rate of 70,000 samples per second and ingestion burst size of 1,000,000 samples.
Sample request
RemoteWrite
POST /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/remote_write --data-binary "@real-dataset.sz" HTTP/1.1
Authorization: AUTHPARAMS X-Amz-Date: 20201201T193725Z User-Agent: Prometheus/2.20.1
Content-Type: application/x-protobuf Content-Encoding: snappy
X-Prometheus-Remote-Write-Version: 0.1.0 body
Note
For the request body syntax, see to the protocol buffer definition at https://github.com/
prometheus/prometheus/blob/1c624c58ca934f618be737b4995e22051f5724c1/prompb/
remote.pb.go#L64.
Sample response
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535 Content-Length:0
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT Content-Type: application/json Server: amazon
vary: Origin