Creates a diagnostic report for a resource. When you call this operation, you can set MetricSetId to generate a diagnostic report based on the specified diagnostic metric set. Then, you can call the DescribeDiagnosticReportAttributes operation based on the returned diagnostic report ID to view the details of the diagnostic report.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateDiagnosticReport

The operation that you want to perform. Set the value to CreateDiagnosticReport.

RegionIdStringYescn-hangzhou

The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list.

ResourceIdStringYesi-uf6i0tv2refv8wz*****

The resource ID.

MetricSetIdStringNodms-uf6i0tv2refv8wz*****

The ID of the diagnostic metric set. If this parameter is left empty, the dms-instancedefault set is used, which is the default diagnostic metric set provided for Elastic Compute Service (ECS) instances.

StartTimeStringNo2022-07-11T12:00Z

The beginning of the reporting period. This parameter takes effect only for diagnostic metrics that do not need to be assessed by running Cloud Assistant commands in guest operating systems.

EndTimeStringNo2022-07-11T14:00Z

The end of the reporting period. This parameter takes effect only for diagnostic metrics that do not need to be assessed by running Cloud Assistant commands in guest operating systems.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE*****

The request ID.

ReportIdStringdr-uf6i0tv2refv8wz*****

The ID of the diagnostic report, which is the unique identifier of the report.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=CreateDiagnosticReport
&RegionId=cn-hangzhou
&ResourceId=i-uf6i0tv2refv8wz*****
&MetricSetId=dms-uf6i0tv2refv8wz*****
&StartTime=2022-07-11T12:00Z
&EndTime=2022-07-11T14:00Z
Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateDiagnosticReportResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE*****</RequestId>
    <ReportId>dr-uf6i0tv2refv8wz*****</ReportId>
</CreateDiagnosticReportResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****",
  "ReportId" : "dr-uf6i0tv2refv8wz*****"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter%sInvalid parameter value.

For a list of error codes, visit the API Error Center.