

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon Managed Service for Prometheus API 참조
<a name="AMP-APIReference"></a>

Amazon Managed Service for Prometheus는 두 가지 유형의 API 제공합니다.

1. **Amazon Managed Service for Prometheus API** - 이러한 API를 사용하면 워크스페이스, 스크레이퍼, 알림 관리자 정의, 규칙 그룹 네임스페이스 및 로깅에 대한 작업을 포함하여 Amazon Managed Service for Prometheus 워크스페이스를 생성하고 관리할 수 있습니다. 다양한 프로그래밍 언어에 사용할 수 있는 AWS SDK를 사용하여 이러한 API와 상호 작용합니다.

1. **Prometheus 호환 API** - Amazon Managed Service for Prometheus는 Prometheus와 호환되는 HTTP API를 지원합니다. 이러한 API를 사용하면 사용자 지정 애플리케이션을 구축하고, 워크플로를 자동화하며, 다른 서비스 또는 도구와 통합하고, Prometheus 쿼리 언어(PromQL)를 사용하여 모니터링 데이터를 쿼리하고 상호 작용할 수 있습니다.

이 섹션에는 Amazon Managed for Amazon Managed for Prometheus에서 지원하는 API 작업 및 데이터 구조가 나열되어 있습니다.

시리즈, 레이블 및 API 요청의 할당량에 대한 자세한 내용은 *Amazon Managed Service for Prometheus 사용 설명서*에서 [Amazon Managed Service for Prometheus 서비스 할당량](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP_quotas.html)을 참조하세요.

**Topics**
+ [Amazon Managed Service for Prometheus API](AMP-APIReference-AMPApis.md)
+ [Prometheus 호환 API](AMP-APIReference-Prometheus-Compatible-Apis.md)

# Amazon Managed Service for Prometheus API
<a name="AMP-APIReference-AMPApis"></a>

Amazon Managed Service for Prometheus는 Amazon Managed Service for Prometheus 워크스페이스를 생성하고 유지 관리하는 API 작업을 제공합니다. 여기에는 워크스페이스, 스크레이퍼, 알림 관리자 정의, 규칙 그룹 네임스페이스 및 로깅에 대한 API가 포함됩니다.

Amazon Managed Service for Prometheus API에 대한 자세한 내용은 [Amazon Managed Service for Prometheus API 참조](https://docs.aws.amazon.com/prometheus/latest/APIReference/Welcome.html)를 참조하세요.

## AWS SDK와 함께 Amazon Managed Service for Prometheus 사용
<a name="AMP-APIReference-SDKs"></a>

다양한 프로그래밍 언어에 대해 AWS 소프트웨어 개발 키트(SDK)를 사용할 수 있습니다. 각 SDK는 개발자가 선호하는 언어로 AWS 애플리케이션을 쉽게 구축할 수 있도록 하는 API, 코드 예제 및 설명서를 제공합니다. 언어별 SDKs 및 도구 목록은 AWS *개발자 센터*의 [AWS 기반의 도구](https://aws.amazon.com/developer/tools/)를 참조하세요.

**SDK 버전**  
프로젝트에 사용하는 최신 AWS SDK 빌드와 기타 SDK를 사용하고 SDK를 최신 상태로 유지하는 것이 좋습니다. AWS SDK는 최신 특징과 기능과 보안 업데이트도 제공합니다.

# Prometheus 호환 API
<a name="AMP-APIReference-Prometheus-Compatible-Apis"></a>

Amazon Managed Service for Prometheus에서는 다음 Prometheus 호환 API를 지원합니다.

 Prometheus 호환 API 사용에 대한 자세한 내용은 [Prometheus 호환 API를 사용한 쿼리](AMP-onboard-query-APIs.md) 섹션을 참조하세요.

**Topics**
+ [CreateAlertManagerAlerts](AMP-APIReference-CreateAlertManagerAlerts.md)
+ [DeleteAlertManagerSilence](AMP-APIReference-DeleteSilence.md)
+ [GetAlertManagerStatus](AMP-APIReference-GetAlertManagerStatus.md)
+ [GetAlertManagerSilence](AMP-APIReference-GetAlertManagerSilence.md)
+ [GetLabels](AMP-APIReference-GetLabels.md)
+ [GetMetricMetadata](AMP-APIReference-GetMetricMetadata.md)
+ [GetSeries](AMP-APIReference-GetSeries.md)
+ [ListAlerts](AMP-APIReference-ListAlerts.md)
+ [ListAlertManagerAlerts](AMP-APIReference-ListAlertManagerAlerts.md)
+ [ListAlertManagerAlertGroups](AMP-APIReference-ListAlertManagerAlertGroups.md)
+ [ListAlertManagerReceivers](AMP-APIReference-ListAlertManagerReceivers.md)
+ [ListAlertManagerSilences](AMP-APIReference-ListAlertManagerSilences.md)
+ [ListRules](AMP-APIReference-ListRules.md)
+ [PutAlertManagerSilences](AMP-APIReference-PutAlertManagerSilences.md)
+ [QueryMetrics](AMP-APIReference-QueryMetrics.md)
+ [RemoteWrite](AMP-APIReference-RemoteWrite.md)

# CreateAlertManagerAlerts
<a name="AMP-APIReference-CreateAlertManagerAlerts"></a>

`CreateAlertManagerAlerts` 작업은 워크스페이스에 알림을 생성합니다.

유효한 HTTP 동사:  
`POST`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/alerts`

URL 쿼리 파라미터:  
`alerts` 각 객체가 하나의 알림을 나타내는 객체 배열입니다. 다음은 알림 객체의 예제입니다.  

```
[
  {
    "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"
  }
]
```

**샘플 요청**

```
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"
    },
    "generatorURL": "https://www.amazon.com/"
  }
]
```

**샘플 응답**

```
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
<a name="AMP-APIReference-DeleteSilence"></a>

`DeleteSilence`는 무음 알림 하나를 삭제합니다.

유효한 HTTP 동사:  
`DELETE`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/silence/silenceID`

URL 쿼리 파라미터: 없음  


**샘플 요청**

```
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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-GetAlertManagerStatus"></a>

`GetAlertManagerStatus`는 알림 관리자의 상태에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/status`

URL 쿼리 파라미터: 없음  


**샘플 요청**

```
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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-GetAlertManagerSilence"></a>

`GetAlertManagerSilence`는 무음 알림 하나에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/silence/silenceID`

URL 쿼리 파라미터: 없음  


**샘플 요청**

```
GET /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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-GetLabels"></a>

`GetLabels` 작업은 시계열과 관련된 레이블을 검색합니다.

유효한 HTTP 동사:  
`GET`, `POST`

유효한 URI:  
`/workspaces/workspaceId/api/v1/labels`  
`/workspaces/workspaceId/api/v1/label/label-name/values` 이 URI는 GET 요청만 지원합니다.

URL 쿼리 파라미터:  
`match[]=<series_selector>` 레이블 이름을 읽을 시리즈를 선택하는 반복 시리즈 선택기 인수입니다. 선택 사항.  
`start=<rfc3339 | unix_timestamp>` 시작 타임스탬프입니다. 선택 사항.  
`end=<rfc3339 | unix_timestamp>` 종료 타임스탬프입니다. 선택 사항.

**`/workspaces/workspaceId/api/v1/labels`에 대한 샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/labels HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**`/workspaces/workspaceId/api/v1/labels`에 대한 샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 1435
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT
Content-Type: application/json
Server: amazon
vary: Origin

{
    "status": "success",
    "data": [
        "__name__",
        "access_mode",
        "address",
        "alertname",
        "alertstate",
        "apiservice",
        "app",
        "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",
        "boot_id",
        "branch",
        "broadcast",
        "buildDate",
        ...
    ]
}
```

**`/workspaces/workspaceId/api/v1/label/label-name/values`에 대한 샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/label/access_mode/values HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**`/workspaces/workspaceId/api/v1/label/label-name/values`에 대한 샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 74
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT
Content-Type: application/json
Server: amazon
vary: Origin

{
    "status": "success",
    "data": [
        "ReadWriteOnce"
    ]
}
```

# GetMetricMetadata
<a name="AMP-APIReference-GetMetricMetadata"></a>

`GetMetricMetadata` 작업은 대상에서 현재 스크래핑 중인 지표에 대한 메타데이터를 검색합니다. 대상 정보는 제공하지 않습니다.

쿼리 결과의 데이터 섹션은 각 키가 지표 이름이고 각 값이 모든 대상에서 해당 지표 이름에 대해 노출되는 고유한 메타데이터 객체 목록인 객체로 구성됩니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/api/v1/metadata`

URL 쿼리 파라미터:  
`limit=<number>` 반환할 최대 지표 수입니다.  
`metric=<string>` 메타데이터를 필터링할 때 지표 이름입니다. 이 파라미터를 비워 두면 모든 지표 메타데이터가 검색됩니다.

**샘플 요청**

```
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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-GetSeries"></a>

`GetSeries` 작업은 특정 레이블 세트와 일치하는 시계열 목록을 검색합니다.

유효한 HTTP 동사:  
`GET`, `POST`

유효한 URI:  
`/workspaces/workspaceId/api/v1/series`

URL 쿼리 파라미터:  
`match[]=<series_selector>` 반환할 시리즈를 선택하는 반복 시리즈 선택기 인수입니다. 1개 이상의 `match[]` 인수를 제공해야 합니다.  
`start=<rfc3339 | unix_timestamp>` 시작 타임스탬프입니다. 선택 사항  
`end=<rfc3339 | unix_timestamp>` 종료 타임스탬프입니다. 선택 사항

**샘플 요청**

```
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
```

**샘플 응답**

```
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",
            "release": "servicesstackprometheuscf14a6d7"
        },
        {
            "__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": "iowait",
            "release": "servicesstackprometheuscf14a6d7"
        },
        ...
    ]
}
```

# ListAlerts
<a name="AMP-APIReference-ListAlerts"></a>

`ListAlerts` 작업은 워크스페이스에서 현재 활성 상태인 알림을 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/api/v1/alerts`

**샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/alerts HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 386
Connection: keep-alive
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",
          "severity": "none"
        },
        "annotations": {
          "message": "message"
        },
        "state": "firing",
        "activeAt": "2020-12-01T19:37:25.429565909Z",
        "value": "1e+00"
      }
    ]
  },
  "errorType": "",
  "error": ""
}
```

# ListAlertManagerAlerts
<a name="AMP-APIReference-ListAlertManagerAlerts"></a>

`ListAlertManagerAlerts`는 워크스페이스의 알림 관리자에서 현재 발생하고 있는 알림에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/alerts`

**샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/alerts HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 354
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT
Content-Type: application/json
Server: amazon
vary: Origin

[
    {
        "annotations": {
            "summary": "this is a test alert used for demo purposes"
        },
        "endsAt": "2021-10-21T22:07:31.501Z",
        "fingerprint": "375eab7b59892505",
        "receivers": [
            {
                "name": "sns-0"
            }
        ],
        "startsAt": "2021-10-21T22:02:31.501Z",
        "status": {
            "inhibitedBy": [],
            "silencedBy": [],
            "state": "active"
        },
        "updatedAt": "2021-10-21T22:02:31.501Z",
        "labels": {
            "alertname": "test-alert"
        }
    }
]
```

# ListAlertManagerAlertGroups
<a name="AMP-APIReference-ListAlertManagerAlertGroups"></a>

`ListAlertManagerAlertGroups` 작업은 워크스페이스의 알림 관리자에 구성된 알림 그룹 목록을 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/alerts/groups`

URL 쿼리 파라미터:  
`active` 부울입니다. true인 경우 반환된 목록에 활성 알림이 포함됩니다. 기본값은 true입니다. 선택 사항  
`silenced` 부울입니다. true인 경우 반환된 목록에는 무음 알림이 포함됩니다. 기본값은 true입니다. 선택 사항  
`inhibited` 부울입니다. true인 경우 반환된 목록에는 금지된 알림이 포함됩니다. 기본값은 true입니다. 선택 사항  
`filter` 문자열 배열입니다. 알림을 필터링할 매처의 목록입니다. 선택 사항  
`receiver` 문자열입니다. 알림을 필터링할 수신기를 일치시키는 정규 표현식입니다. 선택 사항

**샘플 요청**

```
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
```

**샘플 응답**

```
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": {
                    "summary": "this is a test alert used for demo purposes"
                },
                "endsAt": "2021-10-21T22:07:31.501Z",
                "fingerprint": "375eab7b59892505",
                "receivers": [
                    {
                        "name": "sns-0"
                    }
                ],
                "startsAt": "2021-10-21T22:02:31.501Z",
                "status": {
                    "inhibitedBy": [],
                    "silencedBy": [],
                    "state": "unprocessed"
                },
                "updatedAt": "2021-10-21T22:02:31.501Z",
                "generatorURL": "https://www.amazon.com/",
                "labels": {
                    "alertname": "test-alert"
                }
            }
        ],
        "labels": {},
        "receiver": {
            "name": "sns-0"
        }
    }
]
```

# ListAlertManagerReceivers
<a name="AMP-APIReference-ListAlertManagerReceivers"></a>

`ListAlertManagerReceivers` 작업은 알림 관리자에 구성된 수신기에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/receivers`

URL 쿼리 파라미터: 없음  


**샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/alertmanager/api/v2/receivers HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 19
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT
Content-Type: application/json
Server: amazon
vary: Origin

[
    {
        "name": "sns-0"
    }
]
```

# ListAlertManagerSilences
<a name="AMP-APIReference-ListAlertManagerSilences"></a>

`ListAlertManagerSilences` 작업은 워크스페이스에 구성된 무음 알림에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/silences`

**샘플 요청**

```
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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-ListRules"></a>

`ListRules`는 워크스페이스에 구성된 규칙에 대한 정보를 검색합니다.

유효한 HTTP 동사:  
`GET`

유효한 URI:  
`/workspaces/workspaceId/api/v1/rules`

**샘플 요청**

```
GET /workspaces/ws-b226cc2a-a446-46a9-933a-ac50479a5568/api/v1/rules HTTP/1.1
Content-Length: 0, 
Authorization: AUTHPARAMS
X-Amz-Date: 20201201T193725Z
User-Agent: Grafana/8.1.0
```

**샘플 응답**

```
HTTP/1.1 200 OK
x-amzn-RequestId: 12345678-abcd-4442-b8c5-262b45e9b535
Content-Length: 423
Connection: keep-alive
Date: Tue, 01 Dec 2020 19:37:25 GMT
Content-Type: application/json
Server: amazon
vary: Origin

{
    "status": "success",
    "data": {
        "groups": [
            {
                "name": "test-1.rules",
                "file": "test-rules",
                "rules": [
                    {
                        "name": "record:1",
                        "query": "sum(rate(node_cpu_seconds_total[10m:1m]))",
                        "labels": {},
                        "health": "ok",
                        "lastError": "",
                        "type": "recording",
                        "lastEvaluation": "2021-10-21T21:22:34.429565909Z",
                        "evaluationTime": 0.001005399
                    }
                ],
                "interval": 60,
                "lastEvaluation": "2021-10-21T21:22:34.429563992Z",
                "evaluationTime": 0.001010504
            }
        ]
    },
    "errorType": "",
    "error": ""
}
```

# PutAlertManagerSilences
<a name="AMP-APIReference-PutAlertManagerSilences"></a>

`PutAlertManagerSilences` 작업은 새 무음 알림을 생성하거나 기존 무음 알림을 업데이트합니다.

유효한 HTTP 동사:  
`POST`

유효한 URI:  
`/workspaces/workspaceId/alertmanager/api/v2/silences`

URL 쿼리 파라미터:  
`silence` 무음을 나타내는 객체입니다. 형식은 다음과 같습니다.  

```
{
  "id": "string",
  "matchers": [
    {
      "name": "string",
      "value": "string",
      "isRegex": Boolean,
      "isEqual": Boolean
    }
  ],
  "startsAt": "timestamp",
  "endsAt": "timestamp",
  "createdBy": "string",
  "comment": "string"
}
```

**샘플 요청**

```
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":"up",
         "isRegex":false,
         "isEqual":true
      }
   ],
   "startsAt":"2020-07-23T01:05:36+00:00",
   "endsAt":"2023-07-24T01:05:36+00:00",
   "createdBy":"test-person",
   "comment":"test silence"
}
```

**샘플 응답**

```
HTTP/1.1 200 OK
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
<a name="AMP-APIReference-QueryMetrics"></a>

`QueryMetrics` 작업은 단일 시점 또는 일정 기간 동안 인스턴트 쿼리를 평가합니다.

유효한 HTTP 동사:  
`GET`, `POST`

유효한 URI:  
`/workspaces/workspaceId/api/v1/query` 이 URI는 단일 시점의 인스턴트 쿼리를 평가합니다.  
`/workspaces/workspaceId/api/v1/query_range` 이 URI는 일정 기간 동안의 인스턴트 쿼리를 평가합니다.

URL 쿼리 파라미터:  
`query=<string>` Prometheus 표현식 쿼리 문자열입니다. `query` 및 `query_range` 둘 다에 사용됩니다.  
`time=<rfc3339 | unix_timestamp>` (선택 사항) 단일 시점에서 인스턴트 쿼리에 `query`를 사용하는 경우 평가 타임스탬프입니다.  
`timeout=<duration>` (선택 사항) 평가 시간 초과입니다. 기본값은 `-query.timeout` 플래그 값으로 제한됩니다. `query` 및 `query_range` 둘 다에 사용됩니다.  
`start=<rfc3339 | unix_timestamp>` `query_range`를 사용하여 기간에 대해 쿼리하는 경우 시작 타임스탬프입니다.  
`end=<rfc3339 | unix_timestamp>` `query_range`를 사용하여 기간에 대해 쿼리하는 경우 종료 타임스탬프입니다.  
`step=<duration | float>` `duration` 형식 또는 `float`초 단위로 나타내는 쿼리 해결 단계 폭입니다. `query_range`를 사용하여 일정 기간 동안 쿼리하는 경우에만 사용하며, 해당 쿼리에 필요합니다.  
`max_samples_processed_warning_threshold=<integer>` (선택 사항) 처리된 쿼리 샘플(QSP)에 대한 경고 임계값을 설정합니다. 쿼리가 이 임계값에 도달하면 API 응답에 경고 메시지가 반환됩니다.  
`max_samples_processed_error_threshold=<integer>>` (선택 사항) 처리된 쿼리 샘플(QSP)에 대한 오류 임계값을 설정합니다. 이 기준을 초과하는 쿼리는 오류와 함께 거부되어 요금이 부과되지 않습니다. 과도한 쿼리 비용을 방지하는 데 사용됩니다.

**지속 시간**

Prometheus 호환 API의 `duration`은 숫자이며, 그 뒤에 바로 다음 단위 중 하나가 따라옵니다.
+ `ms`밀리초
+ `s`초
+ `m`분
+ `h`시간
+ `d`일(항상 하루를 24시간으로 가정)
+ `w`주(항상 한 주를 7일로 가정)
+ `y`년(항상 1년을 365일로 가정)

**샘플 요청**

```
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
```

**샘플 응답**

```
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
<a name="AMP-APIReference-RemoteWrite"></a>

`RemoteWrite` 작업은 Prometheus 서버의 지표를 원격 URL에 표준화된 형식으로 기록합니다. 일반적으로 Prometheus 서버와 같은 기존 클라이언트를 사용하여 이 작업을 호출합니다.

유효한 HTTP 동사:  
`POST`

유효한 URI:  
`/workspaces/workspaceId/api/v1/remote_write`

URL 쿼리 파라미터:  
없음

`RemoteWrite`의 수집 속도는 초당 70,000개 샘플이고 수집 버스트 크기는 1,000,000개 샘플입니다.

**샘플 요청**

```
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
```

**참고**  
요청 본문 구문은 [ https://github.com/prometheus/prometheus/blob/1c624c58ca934f618be737b4995e22051f5724c1/prompb/remote.pb.go\$1L64](https://github.com/prometheus/prometheus/blob/1c624c58ca934f618be737b4995e22051f5724c1/prompb/remote.pb.go#L64)에서 프로토콜 버퍼 정의를 참조하세요.

**샘플 응답**

```
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
```