Use the mgwutil get-agent command to query the details of a specific agent, such as its status, creation time, and deployment method.
Command format
mgwutil get-agent <agent-name>Parameters
Parameter | Required | Description |
agent-name | Yes | The name of the agent to query. |
Example
Run the following command to query the details of the agent named mgwutil_agent-12.
mgwutil get-agent mgwutil_agent-12Response
Successful response
{
"Code": "success",
"StatusCode": 200,
"LogTime": "2025-12-25 17:51:37",
"Data": {
"ActivationKey": "***-ea55-49ff-83a6-***",
"AgentEndpoint": "vpc",
"CreateTime": "2025-07-15T15:05:45.000Z",
"DeployMethod": "default",
"ModifyTime": "2025-07-15T15:05:45.000Z",
"Name": "mgwutil_agent-12",
"Owner": "***",
"Tags": "",
"TunnelId": "***-168e-42a3-a156-***",
"Version": "***-b334-48de-b7a3-***",
"Status": "Disconnected",
"AgentIp": "192.168.1.20",
"AgentVersion": "1.6.0"
}
}Failed response
{
"Code": "fail",
"StatusCode": 404,
"LogTime": "2026-01-16 10:44:06",
"ErrorMsg": "SDKError: StatusCode: 404 Code: NoSuchImportAgent Message: The specified import agent does not exist Data: {'AccessDeniedDetail':null,'Recommend':null,'ecCode':null,'hostId':'1****96****94***.cn-hangzhou.mgw.aliyuncs.com','requestId':'6969A5F6BE5E3435324F252E','statusCode':404} ",
"ErrorCode": "NoSuchImportAgent",
"RequestId": "6969A5F6BE5E3435324F252E"
}Error codes
Note
The error code indicates the error type. For more information, see the error message (ErrorMsg).
For a list of common error codes, see Common error codes.
ErrorCode | Description |
NoSuchImportAgent | The specified agent does not exist. Confirm that the agent name is correct and that the agent is created. |