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

GetConsoleOutput - 获取命令行输出

最近更新时间2024.04.24 10:07:50

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

调用 GetConsoleOutput 获取实例最近启动、重启或者关机时的系统命令行输出。

使用场景

云服务器无法接入显示设备、无法截屏时,您可以调用该接口,获取最近64KB的系统命令行输出。

注意事项

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

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

GetConsoleOutput

要执行的操作,取值:GetConsoleOutput。

Version
String

2020-04-01

API的版本,取值:2020-04-01。

InstanceId
String

i-3tiefmkskq3vj0******

实例ID。您可以调用DescribeInstances接口查询获取。

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
InstanceId
String

i-3tiefmkskq3vj0******

实例ID。

LastUpdateAt
String

2017-12-08T00:00:00.00Z

最近一次Console输出更新的时间。

Output
String

WzUg3NzY5LjgxMjQ4NF0gUlNQOiAwMDJiOjAwMDAwMGMwMD*******

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*******"
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidInstanceStatus
The status of the specified instance does not support this request.

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

400
InvalidInstanceTypeForGetConsoleOutput.Unsupported
The 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操作系统,不支持该操作。

400
MissingParameter.InstanceId
The required parameter InstanceId is not supplied.

参数实例ID不能为空。

404
InvalidInstance.NotFound
The specified instance does not exist.

指定的实例不存在。

429
FlowLimitExceeded
You've reach the limit on request rate of resources.

您已超过资源请求限速。

500
InternalError
An internal error has occurred.

内部错误,请重试。如果多次尝试失败,请提交工单。