Grafana Cloud API

Grafana Cloud API

Grafana Cloud API는 때때로 Grafana.com API 또는 GCOM API라고도 불리며, Grafana Cloud 스택의 리소스와 프로그래밍 방식으로 상호작용할 수 있게 해줘요.

아래는 일반 사용을 위해 승인된 정적 엔드포인트와 호출 목록이에요. 그 외의 다른 경로는 변경될 수 있으며 일반 사용자를 위해 유지·관리되지 않아요.

참고

대시보드, 알림, 데이터 소스, 사용자 등 Grafana 인스턴스의 리소스를 관리하거나 접근해야 한다면 HTTP API를 참고하세요.

출처: 문서

본문

인증(Authentication)

Cloud API를 사용하려면 Cloud Access Policy와 토큰을 만들어야 해요. Grafana Cloud Access Policy를 만들려면 접근 정책 만들기 문서를 참고하세요.

API 요청은 Authorization 헤더를 사용해 인증돼요:

Authorization: Bearer <token>

접근 정책 및 토큰(Access policies and tokens)

참고

접근 정책에 대한 Grafana Cloud API 엔드포인트의 요청 속도 제한은 시간당 600이에요.

접근 정책과 토큰은 access policy, token, scope, realm, labelselector, conditions 리소스를 사용해요. 이 리소스에 대한 자세한 내용은 Grafana Cloud Access Policies 문서를 참고하세요.

참고

접근 정책과 토큰은 이름, 조직 ID, 지역의 조합이 고유해야 해요.

모든 API 요청은 요청의 Authorization 헤더에 토큰을 지정해야 해요.

이 API는 스택 및 조직 ID와 지역에 의존해요:

  • 스택 ID: https://grafana.com/api/orgs/{org}/instances 엔드포인트에서 가져옴
  • 조직 ID: https://grafana.com/api/orgs/{org} 엔드포인트에서 가져옴
  • 지역: https://grafana.com/api/orgs/{org}/instances 엔드포인트에서 스택의 지역을 가져오거나 https://grafana.com/api/stack-regions 엔드포인트에서 사용 가능한 모든 지역 목록을 가져옴

페이지네이션된 엔드포인트는 선택적으로 pageSize 및 pageCursor 쿼리 매개변수를 허용해요. pageCursor 매개변수를 생략하거나 빈 pageCursor 값을 제공하면 첫 번째 페이지를 받아요.

현재 페이지의 metadata.pagination.nextPage 속성을 통해 다음 페이지의 URL을 얻을 수 있어요. 해당 필드가 null이면 마지막 페이지에 도달한 것이며 더 이상 남은 레코드가 없어요.

접근 정책 만들기(Create an access policy)

POST 메서드로 접근 정책을 만들어요.

POST https://www.grafana.com/api/v1/accesspolicies

매개변수

이름 유형 설명 필수
region String 접근 정책의 지역. 일반적으로 스택이 배포된 곳. Yes

요청 본문

이름 유형 설명 필수
name String 접근 정책의 이름. 1-255자여야 해요. 문자는 영어 소문자(a-z), 숫자(0-9), 하이픈(-), 밑줄(_)만 포함할 수 있어요. Yes
displayName String UI에 표시되는 접근 정책의 표시 이름. 제공하지 않으면 name으로 설정돼요. 1-255자여야 해요. No
scopes List[String] 스코프 목록. Yes
realms List[Realm] realm 목록. Yes
conditions Conditions 접근 정책과 토큰의 접근을 제한하는 데 사용되는 기준 집합. No

Realm

이름 유형 설명 필수
type String realm의 유형. org 또는 stack일 수 있어요. Yes
identifier String realm의 고유 식별자(realm 유형에 따라 org 또는 stack의 ID). Yes
labelPolicies List[LabelPolicy] 라벨 정책 목록. 메트릭 및 로그에 대한 읽기 권한이 있을 때만 사용 가능해요. No

LabelPolicy

이름 유형 설명 필수
selector String 라벨 선택기. Yes

Conditions

이름 유형 설명 필수
allowedSubnets List[String] IP 범위 기반 접근 제어를 위한 CIDR 표기법의 서브넷 마스크가 있는 IP 주소 배열(IPv4 및 IPv6 모두 지원). Yes

요청 예시:

{
  "name": "stack-readers",
  "displayName": "Stack Readers",
  "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
  "realms": [
    {
      "type": "stack",
      "identifier": "123",
      "labelPolicies": [
        {
          "selector": "{env != \"dev\"}"
        }
      ]
    }
  ],
  "conditions": {
    "allowedSubnets": ["192.168.0.0/24", "10.1.2.99/32"]
  }
}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "orgId": "1",
  "name": "stack-readers",
  "displayName": "Stack Readers",
  "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
  "realms": [
    {
      "type": "stack",
      "identifier": "123",
      "labelPolicies": [
        {
          "selector": "{env != \"dev\"}"
        }
      ]
    }
  ],
  "conditions": {
    "allowedSubnets": ["192.168.0.0/24", "10.1.2.99/32"]
  },
  "createdAt": "2022-06-08T20:07:21.223Z",
  "updatedAt": "2022-06-08T20:07:21.223Z"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨.
409 충돌

접근 정책 목록(List access policies)

GET 메서드로 지정된 접근 정책을 나열해요.

GET https://www.grafana.com/api/v1/accesspolicies

매개변수

이름 유형 설명 필수
name Query 필터링할 접근 정책의 이름. No
realmType String Query. 사용 가능한 값은 org와 stack. No
realmIdentifier String realmType이 필요함. realm의 식별자. No
pageSize String 페이지당 반환할 레코드 수. 기본값은 500이고 최대값은 500. No
pageCursor String Query. 결과를 페이지로 나누는 데 사용하는 커서. pageCursor 매개변수를 생략하거나 빈 pageCursor 값을 제공하면 첫 번째 페이지를 받아요. No
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
status String Query. 최종 접근 정책 목록을 필터링하는 데 사용할 수 있는 상태. 사용 가능한 값은 active와 inactive. No

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "items": [
    {
      "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
      "orgId": "1",
      "name": "stack-readers",
      "displayName": "Stack Readers",
      "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
      "realms": [
        {
          "type": "stack",
          "identifier": "123",
          "labelPolicies": [
            {
              "selector": "{env != \"dev\"}"
            }
          ]
        }
      ],
      "conditions": {
        "allowedSubnets": ["192.168.0.0/24", "10.1.2.99/32"]
      },
      "createdAt": "2022-06-08T16:47:46.151Z",
      "updatedAt": "2022-06-08T16:47:46.151Z",
      "status": "active"
    }
  ],
  "metadata": {
    "pagination": {
      "pageSize": 500,
      "pageCursor": "ZDMyYzZhODktZjU1ZC00NGViLWJmYWEtMTEyYmE2NTFlNDJifDIwMjItMDQtMTFUMTI6NTQ6MDBa",
      "nextPage": "/v1/accesspolicies?pageCursor=ZDMyYzZhODktZjU1ZC00NGViLWJmYWEtMTEyYmE2NTFlNDJifDIwMjItMDQtMTFUMTI6NTQ6MDBa"
    }
  }
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨.

하나의 접근 정책 나열(List one access policy)

GET 메서드로 하나의 접근 정책을 나열해요.

GET https://www.grafana.com/api/v1/accesspolicies/{accessPolicyID}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
accessPolicyId String UUID. Path. 접근 정책의 ID. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "orgId": "1",
  "name": "stack-readers",
  "displayName": "Stack Readers",
  "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
  "realms": [
    {
      "type": "stack",
      "identifier": "123",
      "labelPolicies": [
        {
          "selector": "{env != \"dev\"}"
        }
      ]
    }
  ],
  "conditions": {
    "allowedSubnets": ["192.168.0.0/24", "10.1.2.99/32"]
  },
  "createdAt": "2022-06-08T21:06:27.853Z",
  "updatedAt": "2022-06-08T21:06:27.853Z",
  "status": "active"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨.

접근 정책 업데이트(Update an access policy)

POST 메서드로 기존 접근 정책을 업데이트해요.

참고

IP 범위를 제거하려면 다음 중 하나를 수행하세요:

  • allowedSubnets를 빈 배열([])로 설정
  • conditions를 null 또는 빈 객체({})로 설정
POST https://www.grafana.com/api/v1/accesspolicies/{accessPolicyId}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
accessPolicyId String (UUID). Path. 접근 정책의 ID. Yes

요청 본문

요청 본문은 수정된 접근 정책을 지정해요.

이름 유형 설명 필수
displayName String UI에 표시되는 접근 정책의 표시 이름. 1-255자여야 해요. No
scopes List[String] 스코프 목록. Yes
realms List[Realm] realm 목록. Yes
conditions Conditions 접근 정책과 토큰의 접근을 제한하는 데 사용되는 기준 집합. 빈 객체 {}를 제공하면 conditions가 완전히 제거돼요. No
status String 접근 정책의 상태. active 또는 inactive여야 해요. No

Realm

이름 유형 설명 필수
type String realm의 유형. org 또는 stack일 수 있어요. Yes
identifier String realm의 고유 식별자(realm 유형에 따라 org 또는 stack의 ID). Yes
labelPolicies List[LabelPolicy] 라벨 정책 목록. 메트릭 및 로그에 대한 읽기 권한이 있을 때만 사용 가능해요. No

LabelPolicy

이름 유형 설명 필수
selector String 라벨 선택기. Yes

Conditions

이름 유형 설명 필수
allowedSubnets List[String] IP 범위 기반 접근 제어를 위한 CIDR 표기법의 서브넷 마스크가 있는 IP 주소 배열(IPv4 및 IPv6 모두 지원). Yes

요청 예시:

{
  "displayName": "Stack Readers",
  "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
  "realms": [
    {
      "type": "stack",
      "identifier": "123",
      "labelPolicies": [
        {
          "selector": "{env != \"dev\"}"
        }
      ]
    }
  ],
  "conditions": {
    "allowedSubnets": ["192.168.99.100/32"]
  },
  "status": "active"
}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "orgId": "1",
  "name": "stack-readers",
  "displayName": "Stack Readers",
  "scopes": ["metrics:read", "logs:read", "traces:read", "alerts:read"],
  "realms": [
    {
      "type": "stack",
      "identifier": "123",
      "labelPolicies": [
        {
          "selector": "{env != \"dev\"}"
        }
      ]
    }
  ],
  "conditions": {
    "allowedSubnets": ["192.168.99.100/32"]
  },
  "createdAt": "2022-06-08T21:10:37.011Z",
  "updatedAt": "2022-06-08T21:10:37.011Z",
  "status": "active"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨.

접근 정책 삭제(Delete an access policy)

DELETE 메서드로 접근 정책을 제거해요.

DELETE https://www.grafana.com/api/v1/accesspolicies/{accessPolicyId}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
accessPolicyId String (UUID). Path. 접근 정책의 ID. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
204 접근 정책이 성공적으로 삭제됨.
400 잘못된 요청
401 API 토큰이 없거나 잘못됨

토큰 만들기(Create a token)

POST 메서드로 토큰을 만들어요.

POST https://www.grafana.com/api/v1/tokens

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes

요청 본문

요청 본문에는 생성되는 토큰에 대한 세부 정보가 포함돼요.

이름 유형 설명 필수
name String 접근 정책의 이름. 1-255자여야 해요. 문자는 영어 소문자(a-z), 숫자(0-9), 하이픈(-), 밑줄(_)만 포함할 수 있어요. Yes
displayName String UI에 표시되는 토큰의 표시 이름. 제공하지 않으면 name으로 설정돼요. 1-255자여야 해요. No
accessPolicyId String 토큰을 만들 접근 정책의 ID. Yes
expiresAt String 토큰 만료 날짜. 제공하지 않으면 토큰이 만료되지 않아요. No

요청 예시:

{
  "accessPolicyId": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "name": "mytoken",
  "displayName": "My Token",
  "expiresAt": "2022-06-08T22:05:46.958Z"
}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "accessPolicyId": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "name": "mytoken",
  "displayName": "My Token",
  "expiresAt": "2022-06-08T22:05:46.959Z",
  "firstUsedAt": "2022-06-08T22:05:46.959Z",
  "lastUsedAt": "2022-06-08T22:05:46.959Z",
  "createdAt": "2022-06-08T22:05:46.959Z",
  "updatedAt": "2022-06-08T22:05:46.959Z",
  "token": "glc_eyJrIj...OjF9"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨
409 충돌

토큰 집합 나열(List a set of tokens)

GET 메서드로 토큰 집합을 나열해요.

GET https://www.grafana.com/api/v1/tokens

매개변수

이름 유형 설명 필수
accessPolicyId String Query. 필터링할 접근 정책의 ID. No
accessPolicyName String Query. 필터링할 접근 정책의 이름. No
accessPolicyRealmType String Query. 접근 정책 realm의 유형. 사용 가능한 값은 org와 stack. No
accessPolicyRealmIdentifier String Query. 접근 정책 realm의 식별자. accessPolicyRealmType이 필요함. No
name String Query. 필터링할 토큰의 이름. No
expiresBefore String Query. expiresAt이 주어진 시간 이전으로 설정된 토큰을 필터링하는 시간(ISO8601 UTC 형식). No
expiresAfter String Query. expiresAt이 주어진 시간 이후로 설정된 토큰을 필터링하는 시간(ISO8601 UTC 형식). No
pageSize String Query. 페이지당 반환할 레코드 수. 기본값은 500이고 최대값은 500. No
pageCursor String Query. 결과를 페이지로 나누는 데 사용하는 커서. pageCursor 매개변수를 생략하거나 빈 pageCursor 값을 제공하면 첫 번째 페이지를 받아요. No
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
accessPolicyStatus String Query. 접근 정책이 주어진 상태인 토큰만 나열하는 필터. 사용 가능한 값은 active와 inactive. No

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "items": [
    {
      "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
      "accessPolicyId": "c45485b6-8321-4cf2-bcec-12006df755ff",
      "name": "mytoken",
      "displayName": "My Token",
      "expiresAt": "2022-06-08T22:11:05.614Z",
      "firstUsedAt": "2022-06-08T22:11:05.614Z",
      "lastUsedAt": "2022-06-08T22:11:05.614Z",
      "createdAt": "2022-06-08T22:11:05.614Z",
      "updatedAt": "2022-06-08T22:11:05.614Z"
    }
  ],
  "metadata": {
    "pagination": {
      "pageSize": 500,
      "pageCursor": "ZDMyYzZhODktZjU1ZC00NGViLWJmYWEtMTEyYmE2NTFlNDJifDIwMjItMDQtMTFUMTI6NTQ6MDBa",
      "nextPage": "/v1/accesspolicies?pageCursor=ZDMyYzZhODktZjU1ZC00NGViLWJmYWEtMTEyYmE2NTFlNDJifDIwMjItMDQtMTFUMTI6NTQ6MDBa"
    }
  }
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨

단일 토큰 나열(List a single token)

GET 메서드로 지정된 토큰을 나열해요.

GET https://www.grafana.com/api/v1/tokens/{tokenId}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
tokenId String (UUID). Path. 토큰의 ID. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "accessPolicyId": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "name": "mytoken",
  "displayName": "My Token",
  "expiresAt": "2022-06-09T04:31:23.559Z",
  "firstUsedAt": "2022-06-09T04:31:23.559Z",
  "lastUsedAt": "2022-06-09T04:31:23.559Z",
  "createdAt": "2022-06-09T04:31:23.559Z",
  "updatedAt": "2022-06-09T04:31:23.559Z"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨

토큰 업데이트(Update a token)

POST 메서드로 지정된 토큰을 업데이트해요.

POST https://www.grafana.com/api/v1/tokens/{tokenId}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
tokenId String (UUID). Path. 토큰의 ID. Yes

요청 본문

요청 본문에는 토큰에 적용되는 업데이트된 값이 포함돼요.

이름 유형 설명 필수
displayName String UI에 표시되는 토큰의 표시 이름. 1-255자여야 해요. No
expiresAt String 토큰 만료 날짜(ISO8601 UTC 형식). 이 필드를 null로 설정하면 토큰이 만료되지 않아요. No

요청 예시:

{
  "displayName": "My token",
  "expiresAt": "2022-06-09T04:43:16.296Z"
}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업

응답 예시:

{
  "id": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "accessPolicyId": "c45485b6-8321-4cf2-bcec-12006df755ff",
  "name": "mytoken",
  "displayName": "My token",
  "expiresAt": "2022-06-09T04:43:16.296Z",
  "firstUsedAt": "2022-06-09T04:43:16.296Z",
  "lastUsedAt": "2022-06-09T04:43:16.296Z",
  "createdAt": "2022-06-09T04:43:16.296Z",
  "updatedAt": "2022-06-09T04:43:16.296Z"
}
코드 설명
400 잘못된 요청
401 API 토큰이 없거나 잘못됨
409 충돌.

토큰 삭제(Delete a token)

DELETE 메서드로 지정된 토큰을 제거해요.

DELETE https://www.grafana.com/api/v1/tokens/{tokenId}

매개변수

이름 유형 설명 필수
region String Query. 접근 정책에 정의된 접근 정책의 지역. 예시 값으로 us, eu, au, prod-eu-west-3 등이 있어요. 자세한 내용은 지역 목록을 참고하세요. Yes
tokenId String (UUID). Path. 토큰의 ID. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
204 토큰이 성공적으로 삭제됨
400 잘못된 요청
401 API 토큰이 없거나 잘못됨

스택(Stacks)

참고

Grafana Cloud Free에는 스택 1개가, Grafana Cloud Pro에는 최대 스택 3개가 포함돼요. 계정에 추가 스택을 추가하려면 Grafana Cloud 계약 플랜에 대해 지원팀에 문의하세요.

스택 나열(List stacks)

GET https://grafana.com/api/orgs/{org}/instances

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).

응답 예시:

{
  "items": [
    {
      "id": 007303,
      "orgId": 052992,
      "orgSlug": "grafanacom",
      "orgName": "grafanacom",
      "type": "grafana",
      "name": "cloudapistack.grafana.net",
      "url": "https://cloudapistack.grafana.net",
      "slug": "cloudapistack",
      "version": "stable",
      "description": "",
      "status": "active",
      "gateway": "istio",
      "createdAt": "2023-01-04T06:43:24.000Z",
      "createdBy": "foobar",
      "updatedAt": null,
      "updatedBy": "",
      "trial": 0,
      "trialExpiresAt": null,
      "clusterId": 69,
      "clusterSlug": "prod-us-central-0",
      "clusterName": "prod-us-central-0",
      "plan": "gcloud",
      "planName": "Grafana Cloud",
      "billingStartDate": "2023-01-04T06:43:23.000Z",
      "billingEndDate": null,
      "billingActiveUsers": 0,
      "billingGrafanaActiveUsers": 0,
      "billingOnCallActiveUsers": 0,
      "currentActiveUsers": 0,
      "currentActiveAdminUsers": 0,
      "currentActiveEditorUsers": 0,
      "currentActiveViewerUsers": 0,
      "dailyUserCnt": 0,
      "dailyAdminCnt": 0,
      "dailyEditorCnt": 0,
      "dailyViewerCnt": 0,
      "dashboardCnt": 8,
      "datasourceCnts": {},
      "userQuota": 10,
      "dashboardQuota": -1,
      "alertQuota": -1,
      "alertCnt": 0,
      "ssl": true,
      "customAuth": true,
      "customDomain": true,
      "support": true,
      "runningVersion": "9.3.2-45365 (commit: ef5286dd77, branch: v9.3.x)",
      "machineLearning": 0,
      "incident": 0,
      "hmInstancePromId": 715391,
      "hmInstancePromUrl": "https://prometheus-us-central1.grafana.net",
      "hmInstancePromName": "cloudapistack-prom",
      "hmInstancePromStatus": "active",
      "hmInstancePromCurrentUsage": 0,
      "hmInstancePromCurrentActiveSeries": 0,
      "hmInstanceGraphiteId": 715392,
      "hmInstanceGraphiteUrl": "https://graphite-prod-10-prod-us-central-0.grafana.net",
      "hmInstanceGraphiteName": "cloudapistack-graphite",
      "hmInstanceGraphiteType": "graphite-v5",
      "hmInstanceGraphiteStatus": "active",
      "hmInstanceGraphiteCurrentUsage": 0,
      "hlInstanceId": 356665,
      "hlInstanceUrl": "https://logs-prod-017.grafana.net",
      "hlInstanceName": "cloudapistack-logs",
      "hlInstanceStatus": "active",
      "hlInstanceCurrentUsage": 0,
      "amInstanceId": 355647,
      "amInstanceName": "cloudapistack-alerts",
      "amInstanceUrl": "https://alertmanager-us-central1.grafana.net",
      "amInstanceStatus": "active",
      "amInstanceGeneratorUrl": "https://cloudapistack.grafana.net",
      "amInstanceGeneratorUrlDatasource": "",
      "htInstanceId": 353178,
      "htInstanceUrl": "https://tempo-us-central1.grafana.net",
      "htInstanceName": "cloudapistack-traces",
      "htInstanceStatus": "active",
      "regionId": 1,
      "regionSlug": "us",
      "links": [
        {
          "rel": "self",
          "href": "/instances/cloudapistack"
        },
        {
          "rel": "org",
          "href": "/orgs/grafanacom"
        },
        {
          "rel": "plugins",
          "href": "/instances/cloudapistack/plugins"
        }
      ]
    }
  ],
  "orderBy": "name",
  "direction": "asc",
  "total": 1,
  "pages": 1,
  "pageSize": 1000000,
  "page": 1,
  "links": [
    {
      "rel": "self",
      "href": "/instances"
    }
  ]
}

스택의 연결 정보 가져오기(Get a stack's connectivity info)

GET https://grafana.com/api/instances/{slug}/connections

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).

응답 예시:

{
  "privateConnectivityInfo": {
    "tenants": [
      {
        "type": "prometheus",
        "id": 1899232,
        "info": {
          "privateDNS": "cortex-prod-13-cortex-gw.us-east-2.vpce.grafana.net",
          "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-0d13a270cd91a0a3a"
        },
        "ipAllowListCNAME": "src-ips.prometheus-prod-13-prod-us-east-0.grafana.net"
      },
      {
        "type": "graphite",
        "id": 1899233,
        "info": {
          "privateDNS": "cortex-prod-13-cortex-gw.us-east-2.vpce.grafana.net",
          "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-0d13a270cd91a0a3a"
        },
        "ipAllowListCNAME": "src-ips.prometheus-prod-13-prod-us-east-0.grafana.net"
      },
      {
        "type": "logs",
        "id": 1048899,
        "info": {
          "privateDNS": "loki-prod-006-cortex-gw.us-east-2.vpce.grafana.net",
          "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-071e7d98821c1698b"
        },
        "ipAllowListCNAME": "src-ips.logs-prod-006.grafana.net"
      },
      {
        "type": "traces",
        "id": 1043214,
        "info": {
          "privateDNS": "tempo-prod-04-cortex-gw.us-east-2.vpce.grafana.net",
          "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-0a830aaea99ecfc91"
        },
        "ipAllowListCNAME": "src-ips.tempo-prod-04-prod-us-east-0.grafana.net"
      },
      {
        "type": "profiles",
        "id": 1091120,
        "info": {
          "privateDNS": "profiles-prod-001-cortex-gw.us-east-2.vpce.grafana.net",
          "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-079d447d0143b24e7"
        },
        "ipAllowListCNAME": "src-ips.profiles-prod-001.grafana.net"
      },
      {
        "type": "alerts",
        "id": 947554,
        "ipAllowListCNAME": "src-ips.alertmanager-prod-us-east-0.grafana.net"
      },
      {
        "type": "grafana",
        "id": 1091120,
        "ipAllowListCNAME": null
      }
    ],
    "otlp": {
      "privateDNS": "prod-us-east-0-otlp-gateway.us-east-2.vpce.grafana.net",
      "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-0d36af67949f874c4"
    },
    "pdc": {
      "api": {
        "privateDNS": "private-datasource-connect-api.us-east-2.vpce.grafana.net",
        "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-0078cfdaab047fc37"
      },
      "gateway": {
        "privateDNS": "private-datasource-connect.us-east-2.vpce.grafana.net",
        "serviceName": "com.amazonaws.vpce.us-east-2.vpce-svc-032570426402bc97e"
      }
    }
  },
  "influxUrl": "https://influx-prod-13-prod-us-east-0.grafana.net",
  "otlpHttpUrl": "https://otlp-gateway-prod-us-east-0.grafana.net",
  "oncallApiUrl": "https://oncall-prod-us-east-0.grafana.net/oncall",
  "appPlatform": {
    "url": "https://app-platform-apiserver-prod-us-east-0.grafana.net",
    "caData": ""
  }
}

이 엔드포인트에는 스택이 가진 다양한 테넌트에 연결하는 방법이 포함되어 있어요. 지역이 AWS라면 AWS PrivateLink도 포함돼요.

스택 만들기(Create stack)

참고

이 POST 요청은 소문자만 허용해요.

POST https://grafana.com/api/instances

요청 본문

이름 유형 설명 필수
name String 스택의 이름. 관례적으로 인스턴스의 URL과 일치해요. 예: <stack>.grafana.net. Yes
slug String Grafana 인스턴스를 사용할 수 있게 만들 서브도메인. 예를 들어 slug를 <slug>로 설정하면 인스턴스의 전체 URL은 https://<slug>.grafana.net이 돼요. Yes
url String 인스턴스에 사용자 지정 도메인을 사용한다면 여기에 제공해야 해요. 예: "https://grafana.yourdomain.io". No
region String 스택의 지역을 선택하세요. 예를 들어 미국(us) 또는 유럽(eu)을 지정할 수 있어요. GET /api/stack-regions 엔드포인트를 사용해 선택할 수 있는 지역 목록을 확인하세요. 자세한 내용은 지역 목록을 참고하세요. 지역을 지정하지 않으면 기본값은 us예요. No
description String 스택의 용도를 설명하는 짧은 텍스트. No
labels map[String]String UI에서 스택을 시각적으로 구분하려면 스택에 라벨을 추가하세요. 라벨은 키:값 쌍으로, 키와 값 모두 영숫자, ., -, /이 될 수 있어요. 최대 10개의 라벨이 허용돼요. 예: {"team":"platform", "environment":"dev"} No
deleteProtection Boolean 스택이 실수로 삭제되는 것을 방지해요. true로 설정하면 이 보호가 비활성화될 때까지 스택에 대한 삭제 작업이 차단돼요. 프로덕션 또는 중요 환경에 권장돼요. No

참고

사용자 지정 도메인의 경우 도메인을 지정하기 전에 .grafana.net을 가리키는 CNAME 레코드를 설정해야 해요.

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).
409 충돌.

응답 예시:

{
  "id": 507363,
  "orgId": 652992,
  "orgSlug": "grafanacom",
  "orgName": "grafanacom",
  "type": "grafana",
  "name": "createcloudstack",
  "url": "https://createcloudstack.grafana.net",
  "slug": "createcloudstack",
  "version": "stable",
  "labels": {
    "key": "value"
  },
  "description": "",
  "status": "active",
  "gateway": "istio",
  "createdAt": "2023-01-04T08:20:07.000Z",
  "createdBy": "testengineer",
  "updatedAt": null,
  "updatedBy": "",
  "trial": 0,
  "trialExpiresAt": null,
  "clusterId": 69,
  "clusterSlug": "prod-us-central-0",
  "clusterName": "prod-us-central-0",
  "plan": "gcloud",
  "planName": "Grafana Cloud",
  "billingStartDate": "2023-01-04T08:20:06.000Z",
  "billingEndDate": null,
  "billingActiveUsers": 0,
  "billingGrafanaActiveUsers": 0,
  "billingOnCallActiveUsers": 0,
  "currentActiveUsers": 0,
  "currentActiveAdminUsers": 0,
  "currentActiveEditorUsers": 0,
  "currentActiveViewerUsers": 0,
  "dailyUserCnt": 0,
  "dailyAdminCnt": 0,
  "dailyEditorCnt": 0,
  "dailyViewerCnt": 0,
  "dashboardCnt": 0,
  "datasourceCnts": {},
  "userQuota": 10,
  "dashboardQuota": -1,
  "alertQuota": -1,
  "alertCnt": 0,
  "ssl": true,
  "customAuth": true,
  "customDomain": true,
  "support": true,
  "runningVersion": "",
  "machineLearning": 0,
  "incident": 0,
  "deleteProtection": true,
  "hmInstancePromId": 715511,
  "hmInstancePromUrl": "https://prometheus-us-central1.grafana.net",
  "hmInstancePromName": "createcloudstack-prom",
  "hmInstancePromStatus": "active",
  "hmInstancePromCurrentUsage": 0,
  "hmInstancePromCurrentActiveSeries": 0,
  "hmInstanceGraphiteId": 715512,
  "hmInstanceGraphiteUrl": "https://graphite-prod-10-prod-us-central-0.grafana.net",
  "hmInstanceGraphiteName": "createcloudstack-graphite",
  "hmInstanceGraphiteType": "graphite-v5",
  "hmInstanceGraphiteStatus": "active",
  "hmInstanceGraphiteCurrentUsage": 0,
  "hlInstanceId": 356725,
  "hlInstanceUrl": "https://logs-prod-017.grafana.net",
  "hlInstanceName": "createcloudstack-logs",
  "hlInstanceStatus": "active",
  "hlInstanceCurrentUsage": 0,
  "amInstanceId": 355707,
  "amInstanceName": "createcloudstack-alerts",
  "amInstanceUrl": "https://alertmanager-us-central1.grafana.net",
  "amInstanceStatus": "active",
  "amInstanceGeneratorUrl": "https://createcloudstack.grafana.net",
  "amInstanceGeneratorUrlDatasource": "",
  "htInstanceId": 353238,
  "htInstanceUrl": "https://tempo-us-central1.grafana.net",
  "htInstanceName": "createcloudstack-traces",
  "htInstanceStatus": "active",
  "regionId": 1,
  "regionSlug": "us",
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack"
    },
    {
      "rel": "org",
      "href": "/orgs/grafanacom"
    },
    {
      "rel": "plugins",
      "href": "/instances/createcloudstack/plugins"
    }
  ]
}

스택 업데이트(Update stack)

참고

이 POST 요청은 소문자만 허용해요.

POST https://grafana.com/api/instances/{slug}

요청 본문

이름 유형 설명 필수
description String 스택의 용도를 설명하는 짧은 텍스트. No
labels map[String]String 스택의 라벨을 업데이트해요. 라벨은 키:값 쌍으로, 키와 값 모두 영숫자, ., -, /이 될 수 있어요. 최대 10개의 라벨이 허용돼요. 라벨을 제거하려면 이 요청에서 생략하면 돼요. 모든 라벨을 제거하려면 빈 객체를 보내세요. 예: {"team":"platform", "environment":"dev"} No
name String 스택의 이름. 관례적으로 인스턴스의 URL과 일치해요. 예: <stack>.grafana.net. No
deleteProtection Boolean 스택의 삭제 보호를 활성화하거나 비활성화해요. true로 설정하면 스택이 실수로 삭제되는 것을 방지해요. 삭제를 허용하려면 false로 설정하세요. No

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).
409 충돌.

응답 예시:

{
  "id": 507363,
  "orgId": 652992,
  "orgSlug": "grafanacom",
  "orgName": "grafanacom",
  "type": "grafana",
  "name": "createcloudstack",
  "url": "https://createcloudstack.grafana.net",
  "slug": "createcloudstack",
  "labels": {
    "newkey": "newvalue"
  },
  "version": "stable",
  "description": "",
  "status": "active",
  "gateway": "istio",
  "createdAt": "2023-01-04T08:20:07.000Z",
  "createdBy": "testengineer",
  "updatedAt": null,
  "updatedBy": "",
  "trial": 0,
  "trialExpiresAt": null,
  "clusterId": 69,
  "clusterSlug": "prod-us-central-0",
  "clusterName": "prod-us-central-0",
  "plan": "gcloud",
  "planName": "Grafana Cloud",
  "billingStartDate": "2023-01-04T08:20:06.000Z",
  "billingEndDate": null,
  "billingActiveUsers": 0,
  "billingGrafanaActiveUsers": 0,
  "billingOnCallActiveUsers": 0,
  "currentActiveUsers": 0,
  "currentActiveAdminUsers": 0,
  "currentActiveEditorUsers": 0,
  "currentActiveViewerUsers": 0,
  "dailyUserCnt": 0,
  "dailyAdminCnt": 0,
  "dailyEditorCnt": 0,
  "dailyViewerCnt": 0,
  "dashboardCnt": 0,
  "datasourceCnts": {},
  "userQuota": 10,
  "dashboardQuota": -1,
  "alertQuota": -1,
  "alertCnt": 0,
  "ssl": true,
  "customAuth": true,
  "customDomain": true,
  "support": true,
  "runningVersion": "",
  "machineLearning": 0,
  "incident": 0,
  "deleteProtection": true,
  "hmInstancePromId": 715511,
  "hmInstancePromUrl": "https://prometheus-us-central1.grafana.net",
  "hmInstancePromName": "createcloudstack-prom",
  "hmInstancePromStatus": "active",
  "hmInstancePromCurrentUsage": 0,
  "hmInstancePromCurrentActiveSeries": 0,
  "hmInstanceGraphiteId": 715512,
  "hmInstanceGraphiteUrl": "https://graphite-prod-10-prod-us-central-0.grafana.net",
  "hmInstanceGraphiteName": "createcloudstack-graphite",
  "hmInstanceGraphiteType": "graphite-v5",
  "hmInstanceGraphiteStatus": "active",
  "hmInstanceGraphiteCurrentUsage": 0,
  "hlInstanceId": 356725,
  "hlInstanceUrl": "https://logs-prod-017.grafana.net",
  "hlInstanceName": "createcloudstack-logs",
  "hlInstanceStatus": "active",
  "hlInstanceCurrentUsage": 0,
  "amInstanceId": 355707,
  "amInstanceName": "createcloudstack-alerts",
  "amInstanceUrl": "https://alertmanager-us-central1.grafana.net",
  "amInstanceStatus": "active",
  "amInstanceGeneratorUrl": "https://createcloudstack.grafana.net",
  "amInstanceGeneratorUrlDatasource": "",
  "htInstanceId": 353238,
  "htInstanceUrl": "https://tempo-us-central1.grafana.net",
  "htInstanceName": "createcloudstack-traces",
  "htInstanceStatus": "active",
  "regionId": 1,
  "regionSlug": "us",
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack"
    },
    {
      "rel": "org",
      "href": "/orgs/grafanacom"
    },
    {
      "rel": "plugins",
      "href": "/instances/createcloudstack/plugins"
    }
  ]
}

스택 삭제(Delete stack)

DELETE https://grafana.com/api/instances/{slug}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 Cloud Stack을 찾을 수 없음.
409 삭제 보호가 활성화됨.

주의

409 응답 코드를 받으면 스택에 삭제 보호(delete protection)가 활성화되어 있다는 뜻이에요. 스택을 성공적으로 삭제하려면 먼저 스택의 deleteProtection 플래그를 비활성화해야 해요.

응답 예시:

{
  "id": 507366,
  "orgId": 652992,
  "orgSlug": "grafanacom",
  "orgName": "grafanacom",
  "type": "grafana",
  "name": "createcloudstack",
  "url": "https://createcloudstack.grafana.net",
  "slug": "createcloudstack",
  "version": "stable",
  "description": "",
  "status": "deleted",
  "gateway": "istio",
  "createdAt": "2023-01-04T08:22:00.000Z",
  "createdBy": "ishanjain",
  "updatedAt": "2023-01-04T08:30:36.066Z",
  "updatedBy": "ishanjain",
  "trial": 0,
  "trialExpiresAt": null,
  "clusterId": 69,
  "clusterSlug": "prod-us-central-0",
  "clusterName": "prod-us-central-0",
  "plan": "gcloud",
  "planName": "Grafana Cloud",
  "billingStartDate": "2023-01-04T08:21:59.000Z",
  "billingEndDate": "2023-01-04T08:30:36.066Z",
  "billingActiveUsers": 0,
  "billingGrafanaActiveUsers": 0,
  "billingOnCallActiveUsers": 0,
  "currentActiveUsers": 0,
  "currentActiveAdminUsers": 0,
  "currentActiveEditorUsers": 0,
  "currentActiveViewerUsers": 0,
  "dailyUserCnt": 0,
  "dailyAdminCnt": 0,
  "dailyEditorCnt": 0,
  "dailyViewerCnt": 0,
  "dashboardCnt": 0,
  "datasourceCnts": {},
  "userQuota": 10,
  "dashboardQuota": -1,
  "alertQuota": -1,
  "alertCnt": 0,
  "ssl": true,
  "customAuth": true,
  "customDomain": true,
  "support": true,
  "runningVersion": "9.3.2-45365 (commit: ef5286dd77, branch: v9.3.x)",
  "machineLearning": 0,
  "incident": 0,
  "deleteProtection": false,
  "hmInstancePromId": 715517,
  "hmInstancePromUrl": "https://prometheus-us-central1.grafana.net",
  "hmInstancePromName": "createcloudstack-prom",
  "hmInstancePromStatus": "active",
  "hmInstancePromCurrentUsage": 0,
  "hmInstancePromCurrentActiveSeries": 0,
  "hmInstanceGraphiteId": 715518,
  "hmInstanceGraphiteUrl": "https://graphite-prod-10-prod-us-central-0.grafana.net",
  "hmInstanceGraphiteName": "createcloudstack-graphite",
  "hmInstanceGraphiteType": "graphite-v5",
  "hmInstanceGraphiteStatus": "active",
  "hmInstanceGraphiteCurrentUsage": 0,
  "hlInstanceId": 356728,
  "hlInstanceUrl": "https://logs-prod-017.grafana.net",
  "hlInstanceName": "createcloudstack-logs",
  "hlInstanceStatus": "active",
  "hlInstanceCurrentUsage": 0,
  "amInstanceId": 355710,
  "amInstanceName": "createcloudstack1-alerts",
  "amInstanceUrl": "https://alertmanager-us-central1.grafana.net",
  "amInstanceStatus": "active",
  "amInstanceGeneratorUrl": "https://createcloudstack.grafana.net",
  "amInstanceGeneratorUrlDatasource": "",
  "htInstanceId": 353241,
  "htInstanceUrl": "https://tempo-us-central1.grafana.net",
  "htInstanceName": "createcloudstack-traces",
  "htInstanceStatus": "active",
  "regionId": 1,
  "regionSlug": "us",
  "links": [
    {
      "rel": "self",
      "href": "/instances/507366"
    },
    {
      "rel": "org",
      "href": "/orgs/grafanacom"
    },
    {
      "rel": "plugins",
      "href": "/instances/507366/plugins"
    }
  ]
}

Grafana 다시 시작(Restart Grafana)

POST https://grafana.com/api/instances/{slug}/restart

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업
401 API 토큰이 없거나 잘못됨.
404 Cloud Stack을 찾을 수 없음

응답 예시:

true

Hosted Grafana 인스턴스 API 키 만들기(Create Hosted Grafana instance API keys)

POST https://grafana.com/api/instances/{slug}/api/auth/keys

호스팅된 Grafana 인스턴스를 관리하는 데 사용하기 위한 API 키를 만들어요. 이 키는 Grafana Cloud 작업을 위해 만들어진 Grafana Cloud API 키와는 달라요.

이 엔드포인트는 Admin 역할이 필요해요.

요청 본문

이름 유형 설명 필수
name String API 키의 이름. Yes
role String 키의 접근 수준/Grafana 역할. 다음 값 중 하나일 수 있어요: Viewer, Editor, Admin. Yes
secondsToLive Number 키 만료 시간(초). 양수이면 키의 만료 날짜가 설정돼요. null, 0이거나 완전히 생략하면 키가 만료되지 않아요(api_key_max_seconds_to_live 구성 옵션을 설정하지 않은 경우). No

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 Cloud Stack을 찾을 수 없음.
409 충돌.

응답 예시:

{
  "id": 1,
  "name": "testkey",
  "key": "eyJrIj...joxf"
}

데이터 소스 나열(List data sources)

GET https://grafana.com/api/instances/{slug}/datasources

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "items": [
    {
      "id": 25744816,
      "instanceId": 2860016,
      "name": "grafanacloud-usage",
      "type": "prometheus",
      "access": "proxy",
      "grafanaOrgId": 1,
      "url": "https://billing.grafana.net/api/prom",
      "password": "",
      "user": "",
      "database": "",
      "basicAuth": 1,
      "basicAuthUser": "65299211",
      "withCredentials": 0,
      "isDefault": 0,
      "jsonData": {
        "timeInterval": "60s",
        "timeout": "150",
        "prometheusVersion": "2.3.0",
        "prometheusType": "Mimir"
      },
      "version": 1,
      "editable": 1,
      "delete": 0,
      "createdAt": "2023-01-04T08:20:13.484927Z",
      "updatedAt": null
    },
    {
      "id": 25744915,
      "instanceId": 2860016,
      "name": "grafanacloud-createcloudstack-logs",
      "type": "loki",
      "access": "proxy",
      "grafanaOrgId": 1,
      "url": "https://logs-prod-017.grafana.net",
      "password": "",
      "user": "",
      "database": "",
      "basicAuth": 1,
      "basicAuthUser": "3567215",
      "withCredentials": 0,
      "isDefault": 0,
      "jsonData": {
        "timeout": "300"
      },
      "version": 1,
      "editable": 1,
      "delete": 0,
      "createdAt": "2023-01-04T08:20:13.625323Z",
      "updatedAt": null
    }
  ]
}

Grafana 플러그인(Grafana plugins)

API를 사용하면 호스팅된 Grafana 인스턴스에 설치된 플러그인을 관리할 수 있어요.

플러그인은 Grafana Plugins Directory에서 찾을 수 있어요.

인스턴스에 설치된 플러그인 나열(List plugins installed on an instance)

GET https://grafana.com/api/instances/{slug}/plugins

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "items": [
    {
      "id": 256529,
      "instanceId": 507363,
      "instanceUrl": "https://createcloudstack.grafana.net",
      "pluginId": 663,
      "pluginSlug": "grafana-github-datasource",
      "pluginName": "GitHub",
      "version": "1.3.1",
      "latestVersion": "1.3.1",
      "createdAt": "2023-01-04T09:33:55.000Z",
      "updatedAt": null,
      "links": [
        {
          "rel": "self",
          "href": "/instances/507363/plugins/grafana-github-datasource"
        },
        {
          "rel": "instance",
          "href": "/instances/507363"
        }
      ]
    }
  ],
  "orderBy": "pluginName",
  "direction": "asc",
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack/plugins"
    }
  ]
}

인스턴스에 플러그인 추가(Add a plugin to instance)

POST https://grafana.com/api/instances/{slug}/plugins

요청 본문

이름 유형 설명 필수
plugin String 플러그인의 이름. 예: grafana-github-datasource. Yes
version String 설치할 플러그인의 버전. 기본값은 latest. No

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 플러그인 또는 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "id": 256519,
  "instanceId": 507363,
  "instanceUrl": "https://createcloudstack.grafana.net",
  "instanceSlug": "createcloudstack",
  "pluginId": 663,
  "pluginSlug": "grafana-github-datasource",
  "pluginName": "GitHub",
  "version": "1.3.1",
  "latestVersion": "1.3.1",
  "createdAt": "2023-01-04T08:50:42.000Z",
  "updatedAt": null,
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack/plugins/grafana-github-datasource"
    },
    {
      "rel": "instance",
      "href": "/instances/createcloudstack"
    }
  ]
}

설치된 플러그인 정보 가져오기(Get installed plugin info)

GET https://grafana.com/api/instances/{slug}/plugins/{plugin}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 플러그인 또는 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "id": 256519,
  "instanceId": 507363,
  "instanceUrl": "https://createcloudstack.grafana.net",
  "instanceSlug": "createcloudstack",
  "pluginId": 663,
  "pluginSlug": "grafana-github-datasource",
  "pluginName": "GitHub",
  "version": "1.3.1",
  "latestVersion": "1.3.1",
  "createdAt": "2023-01-04T08:50:42.000Z",
  "updatedAt": null,
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack/plugins/grafana-github-datasource"
    },
    {
      "rel": "instance",
      "href": "/instances/createcloudstack"
    }
  ]
}

설치된 플러그인 버전 업데이트(Update installed plugin version)

POST https://grafana.com/api/instances/{slug}/plugins/{plugin}

요청 본문

이름 유형 설명 필수
version String 업데이트된 플러그인의 버전. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 플러그인 또는 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "id": 256519,
  "instanceId": 507363,
  "instanceUrl": "https://createcloudstack.grafana.net",
  "instanceSlug": "createcloudstack",
  "pluginId": 663,
  "pluginSlug": "grafana-github-datasource",
  "pluginName": "GitHub",
  "version": "1.3.0",
  "latestVersion": "1.3.1",
  "createdAt": "2023-01-04T08:50:42.000Z",
  "updatedAt": "2023-01-04T08:55:00.088Z",
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack/plugins/grafana-github-datasource"
    },
    {
      "rel": "instance",
      "href": "/instances/createcloudstack"
    }
  ]
}

설치된 플러그인 삭제(Delete an installed plugin)

DELETE https://grafana.com/api/instances/{slug}/plugins/{plugin}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 플러그인 또는 Cloud Stack을 찾을 수 없음.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "id": 256519,
  "instanceId": 507363,
  "instanceUrl": "https://createcloudstack.grafana.net",
  "instanceSlug": "createcloudstack",
  "pluginId": 663,
  "pluginSlug": "grafana-github-datasource",
  "pluginName": "GitHub",
  "version": "1.3.1",
  "latestVersion": "1.3.1",
  "createdAt": "2023-01-04T08:50:42.000Z",
  "updatedAt": "2023-01-04T08:59:20.794Z",
  "links": [
    {
      "rel": "self",
      "href": "/instances/createcloudstack/plugins/grafana-github-datasource"
    },
    {
      "rel": "instance",
      "href": "/instances/createcloudstack"
    }
  ]
}

지역(Regions)

지역 목록(List regions)

스택을 만들 때 지정할 지역 목록을 가져오려면 다음 호출을 사용하세요.

GET https://grafana.com/api/stack-regions

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
409 충돌하는 작업이며 이미 다른 작업이 진행 중임.

응답 예시:

{
  "items": [
    {
      "id": 1,
      "status": "active",
      "slug": "us",
      "name": "GCP US Central",
      "description": "United States",
      "provider": "gcp",
      "createdAt": "2021-08-20T20:00:27.000Z",
      "updatedAt": "2022-12-12T12:29:37.000Z"
    },
    {
      "id": 2,
      "status": "active",
      "slug": "us-azure",
      "name": "Azure US Central",
      "description": "United States (Azure)",
      "provider": "azure",
      "createdAt": "2021-08-20T20:08:03.000Z",
      "updatedAt": "2022-11-29T12:04:00.000Z"
    },
    {
      "id": 3,
      "status": "active",
      "slug": "eu",
      "name": "GCP Belgium",
      "description": "Europe",
      "provider": "gcp",
      "createdAt": "2021-08-20T20:28:52.000Z",
      "updatedAt": "2022-12-05T18:05:33.000Z"
    },
    {
      "id": 4,
      "status": "active",
      "slug": "au",
      "name": "GCP Australia",
      "description": "Australia",
      "provider": "gcp",
      "createdAt": "2021-11-16T22:03:18.000Z",
      "updatedAt": "2022-09-22T09:27:47.000Z"
    }
  ],
  "orderBy": "id",
  "direction": "asc",
  "total": 9,
  "pages": 1,
  "pageSize": 1000000,
  "page": 1,
  "links": [
    {
      "rel": "self",
      "href": "/stack-regions"
    }
  ]
}

API 키(API keys)

주의

Cloud API 키는 이제 사용 중단(deprecated)됐어요. 대신 Cloud Access Policies를 사용하세요.

API 키 목록(List API keys)

GET https://grafana.com/api/orgs/{org}/api-keys

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).

응답 예시:

{
  "items": [
    {
      "id": 5045812,
      "orgId": 652945,
      "orgSlug": "grafanacom",
      "orgName": "grafanacom",
      "instanceId": null,
      "name": "SRE",
      "role": "Admin",
      "createdAt": "2023-01-04T06:43:51.000Z",
      "updatedAt": null,
      "firstUsed": "2023-01-04T06:44:26.000Z",
      "links": [
        {
          "rel": "self",
          "href": "/orgs/grafanacom/api-keys/SRE"
        },
        {
          "rel": "org",
          "href": "/orgs/grafanacom"
        }
      ]
    }
  ],
  "orderBy": "name",
  "direction": "asc",
  "links": [
    {
      "rel": "self",
      "href": "/orgs/grafanacom/api-keys"
    }
  ]
}

API 키 만들기(Create API key)

POST https://grafana.com/api/orgs/{org}/api-keys

요청 본문

이름 유형 설명 필수
name String API 키 이름 Yes
role String API 키의 권한 수준. Viewer, Editor, Admin, MetricsPublisher 중 하나. Yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
409 충돌.

응답 예시:

{
  "id": 5046212,
  "orgId": 652945,
  "orgSlug": "grafanacom",
  "orgName": "grafanacom",
  "instanceId": null,
  "name": "createapikey",
  "role": "Admin",
  "createdAt": "2023-01-04T07:50:54.000Z",
  "updatedAt": null,
  "firstUsed": null,
  "token": "eyJrIj...Tkyf",
  "links": [
    {
      "rel": "self",
      "href": "/orgs/grafanacom/api-keys/createapikey"
    },
    {
      "rel": "org",
      "href": "/orgs/grafanacom"
    }
  ]
}

API 키 삭제(Delete API key)

DELETE https://grafana.com/api/orgs/{org}/api-keys/{keyName}

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
404 API 키를 찾을 수 없음.

응답 예시:

true

청구 사용량(Billed usage)

이 API를 사용하면 지정된 연도와 월에 대해 스택별로 분류된 청구 사용량(billed usage)을 가져올 수 있어요.

청구 사용량 가져오기(Get billed usage)

GET https://grafana.com/api/orgs/{org}/billed-usage?month={month}&year={year}

매개변수

이름 유형 설명 필수
month Query 청구 사용량을 가져올 월의 숫자 값 yes
year Query 청구 사용량을 가져올 연도의 숫자 값 yes

응답

다음 응답이 반환될 수 있어요.

코드 설명
200 성공적인 작업.
401 API 토큰이 없거나 잘못됨.
403 금지됨(Forbidden).
404 찾을 수 없음.
409 잘못되었거나 누락된 매개변수.

응답 예시:

{
  "items": [
    {
      "id": 1111198068,
      "dimensionId": "hl",
      "dimensionName": "Logs",
      "unit": "GB",
      "includedUsage": 50,
      "totalUsage": 251.02109133593612,
      "overage": 201,
      "orgRates": {
        "tiers": [
          {
            "min": 50,
            "rate": 0.5
          }
        ]
      },
      "amountDue": 100.5,
      "periodStart": "2024-09-01T00:00:00Z",
      "periodEnd": "2024-09-30T23:59:59Z",
      "description": "Hosted Logs Usage - September 2024",
      "notes": "Per-instance Usage\n - example-logs - Usage: 251.021GB\n\nIncluded Usage: 50GB\nTotal Usage: 251.021GB\nUsage in excess of 50GB: 201GB @ $0.5/GB = $100.50\nTotal Usage Amount: $100.50",
      "usages": [
        {
          "id": 1111163428,
          "stackId": 111118,
          "periodStart": "2024-09-01T00:00:00Z",
          "periodEnd": "2024-09-30T23:59:59Z",
          "totalUsage": 251.02109133593612,
          "isProrated": false,
          "ingestUsage": 251.02109133593612,
          "queryUsage": 1255.8636820528654,
          "stackName": "example.grafana.net",
          "stackLabels": {}
        }
      ]
    },
    {
      "id": 2222297587,
      "dimensionId": "hm",
      "dimensionName": "Metrics",
      "unit": "series",
      "includedUsage": 10000,
      "totalUsage": 129755.72,
      "overage": 119756,
      "orgRates": {
        "tiers": [
          {
            "min": 10000,
            "rate": 6.5
          }
        ],
        "includedDPM": 1
      },
      "amountDue": 778.41,
      "periodStart": "2024-09-01T00:00:00Z",
      "periodEnd": "2024-09-30T23:59:59Z",
      "description": "Hosted Metrics Usage - September 2024",
      "notes": "Per-instance Usage\n - example-prom - Series: 55937, DPM: 132364, Usage: 132364\n   Usage pro-rated 2024-09-01 - 2024-09-30: 129756\n\nIncluded Usage: 10000\nTotal Usage: 129756\nUsage in excess of 10000: 119756 @ $6.50/1000 = $778.41\nTotal Usage Amount: $778.41",
      "usages": [
        {
          "id": 1111162008,
          "stackId": 111118,
          "periodStart": "2024-09-01T00:00:00Z",
          "periodEnd": "2024-09-30T23:59:59Z",
          "totalUsage": 129755.72,
          "isProrated": false,
          "activeSeries": 55937,
          "dpm": 132364,
          "stackName": "example.grafana.net",
          "stackLabels": {}
        }
      ]
    },
    {
      "id": 1111195084,
      "dimensionId": "hg",
      "dimensionName": "Grafana Users",
      "unit": "user",
      "includedUsage": 3,
      "totalUsage": 14,
      "overage": 11,
      "orgRates": {
        "tiers": [
          {
            "min": 3,
            "rate": 8
          }
        ]
      },
      "amountDue": 88,
      "periodStart": "2024-09-01T00:00:00Z",
      "periodEnd": "2024-09-30T23:59:59Z",
      "description": "Hosted Grafana Usage - September 2024",
      "notes": "Per-instance Usage\n - example.grafana.net - Total Unique Users: 14\n\nIncluded Users: 3\nTotal Unique Users: 14\nUsers in excess of 3: 11 @ $8/User = $88.00\nTotal Usage Amount: $88.00",
      "usages": [
        {
          "id": 1111157272,
          "stackId": 111118,
          "periodStart": "2024-09-01T00:00:00Z",
          "periodEnd": "2024-09-30T23:59:59Z",
          "totalUsage": 14,
          "isProrated": false,
          "grafanaUsage": 14,
          "onCallUsage": 0,
          "stackName": "example.grafana.net",
          "stackLabels": {}
        }
      ]
    }
  ]
}

더 알아보기 (Learn more)