본문 바로가기
WIKI 기술 지식 베이스

Screenboard API

원문 보기 위키 갱신

Screenboard 엔드포인트를 사용하면 스크린보드를 프로그래밍 방식으로 생성, 업데이트, 삭제, 조회할 수 있어요. 다만 이 엔드포인트는 더 이상 사용하지 않는(오래된) 방식이니, 새 대시보드 엔드포인트를 사용하는 것이 좋습니다.

출처: 문서

본문

{% alert level="warning" %} 이 엔드포인트는 더 이상 사용하지 않아요(outdated). 새 Dashboard 엔드포인트를 대신 사용하세요. {% /alert %}

Screenboard 엔드포인트를 사용하면 스크린보드를 프로그래밍 방식으로 생성, 업데이트, 삭제, 조회할 수 있어요.

스크린보드 생성

시그니처

POST https://api.datadoghq.com/api/v1/screen

인자

  • board_title [필수]: 대시보드의 이름.
  • description [선택, 기본값=None]: 대시보드 내용에 대한 설명.
  • widgets [필수]: 위젯 정의 목록. 위젯 정의를 얻으려면 위젯 구성 UI의 JSON 탭을 사용하세요.
  • template_variables [선택, 기본값=None]: 대시보드 템플릿팅을 위한 템플릿 변수 목록.
  • read_only [선택, 기본값=False]: 스크린보드의 읽기 전용 상태.

예시

{% tab title="Python" %}

from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

board_title = "My Screenboard"
description = "An informative screenboard."
width = 1024
widgets = [{
    "type": "image",
    "height": 20,
    "width": 32,
    "y": 7,
    "x": 32,
    "url": "https://path/to/image.jpg"
}]
template_variables = [{
    "name": "host1",
    "prefix": "host",
    "default": "host:my-host"
}]

api.Screenboard.create(board_title=board_title,
                       description=description,
                       widgets=widgets,
                       template_variables=template_variables,
                       width=width)

{% /tab %}

{% tab title="Ruby" %}

require 'rubygems'
require 'dogapi'

api_key='<DATADOG_API_KEY>'
app_key='<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

board = {
    "width" => 1024,
    "height" => 768,
    "board_title" => "dogapi test",
    "widgets" => [
        {
          "type" => "image",
          "height" => 20,
          "width" => 32,
          "y" => 7,
          "x" => 32,
          "url" => "https://path/to/image.jpg"
        }
    ]
}

result = dog.create_screenboard(board)

{% /tab %}

{% tab title="Bash" %}

api_key=<DATADOG_API_KEY>
app_key=<DATADOG_APPLICATION_KEY>

curl -X POST -H "Content-type: application/json" \
-d '{
        "width": 1024,
        "height": 768,
        "board_title": "dogapi test",
        "widgets": [
            {
              "type": "image",
              "height": 20,
              "width": 32,
              "y": 7,
              "x": 32,
              "url": "https://path/to/image.jpg"
            }
        ]
}' \
"https://api.datadoghq.com/api/v1/screen?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}"

{% /tab %}

스크린보드 업데이트

시그니처

PUT https://api.datadoghq.com/api/v1/screen/<SCREEENBOARD_ID>

인자

  • board_title [필수]: 대시보드의 이름.
  • description [선택, 기본값=None]: 대시보드 내용에 대한 설명.
  • widgets [필수]: 위젯 정의 목록. 위젯 정의를 얻으려면 위젯 구성 UI의 JSON 탭을 사용하세요.
  • template_variables [선택, 기본값=None]: 대시보드 템플릿팅을 위한 템플릿 변수 목록.
  • width [선택, 기본값=None]: 스크린보드 너비(픽셀).
  • height [선택, 기본값=None]: 스크린보드 높이(픽셀).
  • read_only [선택, 기본값=False]: 스크린보드의 읽기 전용 상태.

예시

{% tab title="Python" %}

from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)
board_id = 2551
board_title = "My Screenboard"
description = "An informative screenboard."
width = 1024
widgets = [{
    "type": "image",
    "height": 20,
    "width": 32,
    "y": 7,
    "x": 32,
    "url": "https://path/to/image.jpg"
}]
template_variables = [{
    "name": "host1",
    "prefix": "host",
    "default": "host:my-host"
}]

api.Screenboard.update(board_id,
                       board_title=board_title,
                       description=description,
                       widgets=widgets,
                       template_variables=template_variables,
                       width=width)

{% /tab %}

{% tab title="Ruby" %}

require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

board_id = 7953
board = {
    "width" => 1024,
    "height" => 768,
    "board_title" => "dogapi test",
    "widgets" => [{
        "type" => "image",
        "height" => 20,
        "width" => 32,
        "y" => 7,
        "x" => 32,
        "url" => "https://path/to/image.jpg"
    }]
}

result = dog.update_screenboard(board_id, board)

{% /tab %}

{% tab title="Bash" %}

api_key=<DATADOG_API_KEY>
app_key=<DATADOG_APPLICATION_KEY>

curl -X PUT -H "Content-type: application/json" \
-d '{
        "width": 1024,
        "height": 768,
        "board_title": "dogapi test",
        "widgets": [
            {
              "type": "image",
              "height": 20,
              "width": 32,
              "y": 7,
              "x": 32,
              "url": "https://path/to/image.jpg"
            }
        ]
}' \
"https://api.datadoghq.com/api/v1/screen/${board_id}?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}"

{% /tab %}

스크린보드 삭제

기존 스크린보드를 삭제합니다. 이 엔드포인트는 JSON 인자를 받지 않아요.

시그니처

DELETE https://api.datadoghq.com/api/v1/screen/<SCREEENBOARD_ID>

인자

이 엔드포인트는 JSON 인자를 받지 않아요.

예시

{% tab title="Python" %}

from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

api.Screenboard.delete(811)

{% /tab %}

{% tab title="Ruby" %}

require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

board_id = '2534'
result = dog.delete_screenboard(board_id)

{% /tab %}

{% tab title="Bash" %}

api_key=<DATADOG_API_KEY>
app_key=<DATADOG_APPLICATION_KEY>
board_id=2471

# Create a screenboard to delete
board_id=$(curl -X POST -H "Content-type: application/json" \
-d '{
        "width": 1024,
        "height": 768,
        "board_title": "dogapi tests",
        "widgets": [
            {
              "type": "image",
              "height": 20,
              "width": 32,
              "y": 7,
              "x": 32,
              "url": "https://path/to/image.jpg"
            }
        ]
  }' \
"https://api.datadoghq.com/api/v1/screen?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}" | jq '.id')

curl -X DELETE \
"https://api.datadoghq.com/api/v1/screen/${board_id}?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}"

{% /tab %}

스크린보드 조회

기존 스크린보드 정의를 가져옵니다.

시그니처

GET https://api.datadoghq.com/api/v1/screen/<SCREEENBOARD_ID>

인자

이 엔드포인트는 JSON 인자를 받지 않아요.

예시

{% tab title="Python" %}

from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

api.Screenboard.get(811)

{% /tab %}

{% tab title="Ruby" %}

require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

board_id = '6334'
result = dog.get_screenboard(board_id)

{% /tab %}

{% tab title="Bash" %}

api_key=<DATADOG_API_KEY>
app_key=<DATADOG_APPLICATION_KEY>
board_id=6334

# Create a screenboard to get
board_id=$(curl -X POST -H "Content-type: application/json" \
-d '{
        "width": 1024,
        "height": 768,
        "board_title": "dogapi tests",
        "widgets": [
            {
              "type": "image",
              "height": 20,
              "width": 32,
              "y": 7,
              "x": 32,
              "url": "https://path/to/image.jpg"
            }
        ]
  }' \
"https://api.datadoghq.com/api/v1/screen?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}" | jq '.id')

curl -X GET \
"https://api.datadoghq.com/api/v1/screen/${board_id}?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}"

{% /tab %}

모든 스크린보드 조회

모든 스크린보드의 정의를 가져옵니다.

시그니처

GET https://api.datadoghq.com/api/v1/screen

인자

이 엔드포인트는 JSON 인자를 받지 않아요.

예시

{% tab title="Python" %}

from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

api.Screenboard.get_all()

{% /tab %}

{% tab title="Ruby" %}

require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

result = dog.get_all_screenboards()

{% /tab %}

{% tab title="Bash" %}

api_key=<DATADOG_API_KEY>
app_key=<DATADOG_APPLICATION_KEY>

curl -X GET "https://api.datadoghq.com/api/v1/screen?api_key=${DD_CLIENT_API_KEY}&application_key=${DD_CLIENT_APP_KEY}"

{% /tab %}

더 알아보기 (Learn more)

도움이 되는 추가 문서, 링크, 아티클이에요: