本文へ
ドキュメントAPI リファレンスサーバーメトリクスを取得
GETBearer トークン

サーバーメトリクスを取得

/api/v1/servers/:id/metrics

保存済みのサーバーメトリクスを取得します。latest は最新の報告、samples は過去のデータ点で、構造が異なります。

API のフィールド名、型、コードはすべての言語で共通です。

リクエスト例

cURL
curl "https://tovahub.com/api/v1/servers/507f1f77bcf86cd799439012/metrics?period=24hr" \
  -H "Authorization: Bearer $TOVAHUB_TOKEN"

表示のみ。このページから API リクエストは送信されません。

レスポンス例
JSON
{
  "period": "24hr",
  "serverStatus": "running",
  "metrics": {
    "online": false,
    "reportingMode": 1,
    "reportInterval": 60,
    "lastReportedAt": null,
    "lastSampledAt": null,
    "bootChangedAt": null,
    "shutdownAt": null
  },
  "latest": null,
  "samples": []
}

パラメーター

idパス · 必須

string

リソース ID。24 桁の16進数文字列です。対応する一覧エンドポイントが返すプラットフォーム ID を使用し、プロバイダーのインスタンス ID は使用しないでください。

periodクエリ · 任意

"1hr" | "24hr" | "7d"

既定値は 24hr。

レスポンス

HTTP ステータス 200

保存済みのホストメトリクス、最新の報告、履歴サンプルを取得します。

periodstring ('1hr' | '24hr' | '7d')

指定された履歴期間。

serverStatusstring

正規化された保存済みサーバー状態。

metricsobject

監視の稼働状況を示すメタデータ。

metrics.onlineboolean

最近の報告から監視エージェントがオンラインと判断されるかどうか。

metrics.reportingModenumber

現在設定されている報告モード。既定値は 1。

metrics.reportIntervalnumber

想定される報告間隔(秒)。

metrics.lastReportedAtstring (ISO 8601) | null

最後に報告を受信したタイムスタンプ。

metrics.lastSampledAtstring (ISO 8601) | null

最後にサンプリングしたタイムスタンプ。

metrics.bootChangedAtstring (ISO 8601) | null

最後に検出された起動識別の変化。

metrics.shutdownAtstring (ISO 8601) | null

最後に報告されたシャットダウン。

latestobject | null

最後に保存されたメトリクスまたはシャットダウン報告。報告がない場合は null。履歴サンプルとはフィールドが異なります。

latest.version1

報告形式のバージョン。

latest.kind"metrics" | "shutdown"

報告の種類。

latest.bootIdstring (UUID)

報告対象の起動を示す識別子。

latest.intervalnumber

サンプリング間隔。5–300 秒。

latest.uptimenumber

稼働時間(秒)。

latest.sampledAtnumber (optional)

Unix epoch からのミリ秒数で表したクライアントのサンプルタイムスタンプ。

latest.cpunumber | null

CPU 使用率。0 から 100 パーセント。取得できない場合は null。

latest.memoryUsednumber

使用中のメモリ容量(バイト)。

latest.memoryTotalnumber

メモリ総容量(バイト)。

latest.swapUsednumber

使用中のスワップ容量(バイト)。

latest.swapTotalnumber

スワップ総容量(バイト)。

latest.diskReadnumber | null

ディスク読み取り速度(バイト/秒)。

latest.diskWritenumber | null

ディスク書き込み速度(バイト/秒)。

latest.netInnumber | null

ネットワーク受信速度(バイト/秒)。

latest.netOutnumber | null

ネットワーク送信速度(バイト/秒)。

latest.disksobject[]

マウント済みディスク。最大 32 件。mount(文字列)、total(バイト)、used(バイト)を含みます。

samplesarray

時系列順の履歴データ点。最大 600 件。数値は時間区間ごとの平均値で、low と high には各指標の最小値・最大値を保持します。

samples[].atstring (ISO 8601)

履歴サンプルのタイムスタンプ。

samples[].cpunumber | null

CPU 使用率(パーセント)。取得できない場合は null。

samples[].memoryUsednumber | null

容量(バイト)。取得できない場合は null。

samples[].memoryTotalnumber | null

容量(バイト)。取得できない場合は null。

samples[].swapUsednumber | null

容量(バイト)。取得できない場合は null。

samples[].swapTotalnumber | null

容量(バイト)。取得できない場合は null。

samples[].diskReadnumber | null

転送速度(バイト/秒)。取得できない場合は null。

samples[].diskWritenumber | null

転送速度(バイト/秒)。取得できない場合は null。

samples[].netInnumber | null

転送速度(バイト/秒)。取得できない場合は null。

samples[].netOutnumber | null

転送速度(バイト/秒)。取得できない場合は null。

samples[].uptimenumber | null

稼働時間(秒)。取得できない場合は null。

samples[].disksarray

マウント済みディスク:{mount: string, used: number, total: number}。容量はバイト単位です。

samples[].lowobject

各指標の最小値。同じ 10 個の数値指標名をキーに使用します。

samples[].highobject

各指標の最大値。同じ 10 個の数値指標名をキーに使用します。