Datadog Infrastructure JSON API permalink


公式ドキュメントに記載が無い為、不確定な部分が多々ありますが、調べた内容を記載します。

JSON API permalink

Infrastructure List で参照可能なデータのJSON。

  • [Datadog] -> [Infrastrucure] -> [Infrastructure List] -> [JSON API permalink]

curl での取得方法

$ apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ appkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ curl -s -S "https://app.datadoghq.com/reports/v2/overview?api_key=${apikey}&application_key=${appkey}"

オプション

with_〜 オプションは指定しないか、値無しでfalse。(falseを指定してもtrueとなる)

  • 例:
    • ON
      • with_app=true
      • with_app=XXX (任意の文字列)
    • OFF
      • 指定しない
      • with_app= (値を指定しない)
オプション 内容
with_apps App Runnings
with_sources データ取得元 (agent,aws,etc...)
with_aliases ホスト名候補
with_meta agentから取得できるメタデータ
with_mute_status hostがmuteされている場合のmute解除時間(UNIX TIME)。mute状態で無い場合はnull。
with_tags true固定(?)。オプション指定/未指定時でも結果が変わらず(?)。
metrics メトリクス情報をクエリ(aggregation:metric形式)で指定。カンマ区切りで複数指定可。 row_metrics、rows.metorics を付与。

JSON構造

第一階層

[
  "display_hostname_dropdown",
  "row_type",
  "rows",
  "window"
]

window以外の各パラメータは固定のようです。

項目(key) 設定値 内容
display_hostname_dropdown ー(?) 固定でtrue
row_type ー(?) 固定でhost
rows 各ホスト情報
window w/d/h/h:m 出力対象ウィンドウ。デフォルト 3h:15m

rows (AWS)

[
  "aws_id",
  "aws_name",
  "display_name",
  "has_metrics",
  "host_name",
  "id",
  "last_seen",
  "name",
  "tags_by_source",
  "up"
]
項目(key) 内容
aws_id AWS上での一意な識別子 (EC2 InstanceID、ELB DNSName、RDS Endpoint、etc...)
aws_name AWS上での名称 (EC2 tag Name、ELB LoadBalancerName、RDS dbinstanceidentifier、etc...)
display_name Datadog上での表示名
has_metrics メトリクスを保持しているか。オプション未指定の場合 false 固定。
host_name Datadog上での識別子
id Datadog上でのID
last_seen 最終更新日時(?)。UNIX TIME。
name Datadog上での表示名。display_nameと同値(?)
tags_by_source Host Tags
up Datadogでデータが受信できているか{true/false}。ホスト削除後3時間はデータ保持。

Host Tags

Name:Value または Value 形式。

  • AWS : Amazon Web Services
  • User : Users

with_meta

with_meta オプションを有効化した場合に付与。

  "agent_checks",
  "agent_version",
  "cpuCores",
  "gohai",
  "host_id",
  "machine",
  "nixV",
  "platform",
  "processor",
  "pythonV",
  "timezones"

metrics

with_metrics オプションを有効化した場合に付与。

Datapoint(UNIXTIME), Value が指定したクエリ分、配列で返る。

  • "avg:aws.ec2.cpuutilization,avg:system.load.5" 例
      "metrics": [
        [
          1495761500,
          0.800000011920929
        ],
        [
          1495761860,
          0
        ]
      ],

row_metrics

metrics オプションを有効化した場合に付与。

[
  "aggr",
  "columns",
  "expression",
  "meta",
  "name"
]
  • avg:aws.ec2.cpuutilization を指定した場合の例
{
  "meta": {
    "description": "Average percentage of allocated EC2 compute units that are currently in use on the instance.",
    "short_name": "cpu utilization",
    "unit_id": 17,
    "metric_type": "gauge",
    "per_unit_id": null,
    "unit": [
      {
        "scale_factor": 1,
        "family": "percentage",
        "short_name": "%",
        "plural": "percent",
        "id": 17,
        "name": "percent"
      },
      null
    ],
    "orientation": 0,
    "interval": null,
    "org_id": -1,
    "integration": "amazon_ec2",
    "metric_key": 100
  },
  "expression": "avg:aws.ec2.cpuutilization{*} by {host}",
  "name": "aws.ec2.cpuutilization",
  "columns": [
    "timestamp",
    "last"
  ],
  "aggr": "avg"
}