You need to enable JavaScript to run this app.
导航

GetConsoleOutput

最近更新时间2023.11.20 19:41:05

首次发布时间2023.03.03 08:16:30

调用 GetConsoleOutput 接口,获取实例最近启动、重启或者关机时的系统命令行输出。云服务器无法接入显示设备、无法截屏,您也可以调用该接口,获取最近64KB的系统命令行输出。

说明

  • 暂不支持Windows实例。
  • 暂不支持弹性裸金属型规格的实例。
  • 仅支持获取运行中状态实例的系统日志。
  • 本接口存在请求频率限制,建议两次请求间隔10S左右,避免请求频率超过接口限制。

调试

请求参数

名称类型是否必填示例值描述
ActionStringGetConsoleOutput要执行的操作,取值 GetConsoleOutput。
VersionString2020-04-01接口的版本,取值:2020-04-01。
InstanceIdStringi-3tiefmkskq3vj0****实例ID。您可以调用DescribeInstances接口查询获取。

返回数据

名称类型示例值说明
InstanceIdStringi-3tiefmkskq3vj0****实例ID。
LastUpdateAtString2017-12-08T00:00:00.00Z最近一次Console输出更新的时间。
OutputStringWzUg3NzY5LjgxMjQ4NF0gUlNQOiAwMDJiOjAwMDAwMGMwMD*******Base64编码后的实例的系统命令行输出。

请求示例

GET /?Action=GetConsoleOutput&Version=2020-04-01&InstanceId=i-3tiefmkskq3vj0****** HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
ServiceName: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "202106111445100102252431000052****",
        "Action": "GetConsoleOutput",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "InstanceId": "i-3tiefmkskq3vj0******",
        "LastUpdateAt": "2017-12-08T00:00:00.00Z",
        "Output": "WzUg3NzY5LjgxMjQ4NF0gUlNQOiAwMDJiOjAwMDAwMGMwMD*******"
    }
}

错误码

HttpCode错误码错误信息描述

400

InvalidInstanceStatus

The status of the specified instance does not support this request.

当前实例的状态不支持此操作。

400InvalidInstanceTypeForGetConsoleOutput.UnsupportedThe specified InstanceType does not support get instance console output.指定的实例类型不支获取实例系统日志。

400

InvalidOperationForWindows.Unsupported

The OSType of this specified instance is Windows, which does not support the operation.

指定的实例是Windows操作系统,不支持该操作。

400MissingParameter.InstanceIdThe required parameter InstanceId is not supplied.实例ID不能为空。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
429FlowLimitExceededYou've reach the limit on request rate of resources.您已超过资源请求限速。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。