すべてのプロダクト
Search
ドキュメントセンター

Cloud Monitor:PutCustomMetric

最終更新日:Jun 11, 2026

PutCustomMetric 操作を呼び出して、カスタム監視のモニタリングデータをレポートします。

操作説明

説明

We recommend that you use the PutHybridMonitorMetricData operation in Enterprise CloudMonitor.

今すぐお試しください

この API を OpenAPI Explorer でお試しください。手作業による署名は必要ありません。呼び出しに成功すると、入力したパラメーターに基づき、資格情報が組み込まれた SDK コードが自動的に生成されます。このコードをダウンロードしてローカルで使用できます。

テスト

RAM 認証

下表に、この API を呼び出すために必要な認証情報を示します。認証情報は、RAM (Resource Access Management) ポリシーを使用して定義できます。以下で各列名について説明します。

  • アクション:特定のリソースに対して実行可能な操作。ポリシー構文ではAction要素として指定します。

  • API:アクションを具体的に実行するための API。

  • アクセスレベル:各 API に対して事前定義されているアクセスの種類。有効な値:create、list、get、update、delete。

  • リソースタイプ:アクションが作用するリソースの種類。リソースレベルでの権限をサポートするかどうかを示すことができます。ポリシーの有効性を確保するため、アクションの対象として適切なリソースを指定してください。

    • リソースレベルの権限を持つ API の場合、必要なリソースタイプはアスタリスク (*) でマークされます。ポリシーのResource要素で対応する ARN を指定してください。

    • リソースレベルの権限を持たない API の場合、「すべてのリソース」と表示され、ポリシーのResource要素でアスタリスク (*) でマークされます。

  • 条件キー:サービスによって定義された条件のキー。このキーにより、きめ細やかなアクセス制御が可能になります。この制御は、アクション単体に適用することも、特定のリソースに対するアクションに適用することもできます。Alibaba Cloud は、サービス固有の条件キーに加えて、すべての RAM 統合サービスに適用可能な一連の共通条件キーを提供しています。

  • 依存アクション:ある特定のアクションを実行するために、前提として実行が必要となる他のアクション。依存アクションの権限も RAM ユーザーまたは RAM ロールに付与する必要があります。

アクション

アクセスレベル

リソースタイプ

条件キー

依存アクション

cms:PutCustomMetric

create

*All Resource

*

なし なし

リクエストパラメーター

パラメーター

型

必須 / 任意

説明

例

MetricList

array<object>

必須

モニタリングデータのリスト。

object

任意

Type

string

必須

The type of the reported value. Valid values of N: 1 to 21. Valid values:

  • 0: raw data.

  • 1: aggregate data.

説明

When you report aggregate data, we recommend that you report both data with a period of 60 seconds and data with a period of 300 seconds. Otherwise, monitoring data cannot be queried for a time span of more than 7 days.

0

MetricName

string

必須

The name of the metric. Valid values of N: 1 to 21. For more information, see Metrics of cloud services.

cpu_total

Time

string

任意

The time when the metric occurred. Valid values of N: 1 to 21. The following two types of values are supported:

  • UTC time. Format: YYYY-MM-DDThh:mm:ssZ. For example: 20171012T132456.888+0800.

  • A Long-type timestamp. For example: 1508136760000.

1508136760000

GroupId

string

必須

The ID of the application group. Valid values of N: 1 to 21.

説明

If the metric does not belong to any application group, enter 0.

12345

Values

string

必須

The collection of metric values. Valid values of N: 1 to 21.

説明

If the type of the reported value is 0, the raw values are reported. CloudMonitor aggregates raw values into multiple values, such as maximum, count, and sum, by period.

{"value":10.5}

Dimensions

string

必須

The dimension map, which is used to query monitoring data of a specified resource. Valid values of N: 1 to 21.

Format: a collection of key-value pairs. A commonly used key-value pair collection is: {"Key":"Value"}.

The length of Key and Value is 1 to 64 characters. Characters beyond the first 64 are truncated.

The values of Key and Value can contain letters, digits, periods (.), hyphens (-), underscores (_), forward slashes (/), and backslashes ().

説明

Dimensions must be passed in as a JSON string that represents the map object, and must be passed in order.

{"sampleName1":"value1","sampleName2":"value2"}

Period

string

任意

The aggregation period. Valid values of N: 1 to 21. Unit: seconds. Valid values: 60 and 300.

説明

If the type of the reported value is 1, you must set this parameter.

60

レスポンスフィールド

フィールド

型

説明

例

object

Code

string

The status code.

説明

200 indicates success.

200

Message

string

The error message.

The request has failed due to a temporary failure of the server.

RequestId

string

The request ID.

05B36C2C-5F6E-48D5-8B41-CE36DD7EE8E0

例

成功レスポンス

JSONJSON

{
  "Code": "200",
  "Message": "The request has failed due to a temporary failure of the server.",
  "RequestId": "05B36C2C-5F6E-48D5-8B41-CE36DD7EE8E0"
}

エラーコード

HTTP ステータスコード

エラーコード

エラーメッセージ

説明

400 %s %s
500 %s %s
500 InternalError %s
403 %s %s
404 %s %s

完全なリストについては、「エラーコード」をご参照ください。

変更履歴

完全なリストについては、「変更履歴」をご参照ください。