閱讀223 返回首頁    go 阿裏雲


ListMachines__Logtail機器組相關接口_API-Reference_日誌服務-阿裏雲

獲得MachineGroup下屬於用戶並與Server端連接機器狀態信息

GET /machinegroups/{groupName}/machines?offset=1&size=10

GET /machinegroups/{groupName}/machines HTTP/1.1
Authorization: <AuthorizationString> 
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1

請求參數

URL參數:

名稱 類型 必須 描述
groupName string 機器分組名稱
offset int 返回記錄的起始位置,默認為0
size int 每頁返回最大條目,默認500(最大值)

請求頭

無特有請求頭,關於Log Service API的公共請求頭請參考公共請求頭

響應頭

無特有響應頭,關於Log Service API的公共響應頭請參考公共響應頭

響應元素

名稱 類型 描述
count int 返回的machine數目
total int machine總數
machines json array 返回的machine名稱列表

machines說明如下:

名稱 類型 描述
ip string 機器ip
machine-uniqueid string 機器DMI UUID
userdefined-id string 機器的用戶自定義標示
{
    "count":10,
    "total":100,
    "machines":
    [{
        "ip" : "testip1",
        "machine-uniqueid" : "testuuid1",
        "userdefined-id" : "testuserdefinedid1",
        "lastHeartbeatTime" : 1447182247
    },
    {
        "ip" : "testip1",
        "machine-uniqueid" : "testuuid2",
        "userdefined-id" : "testuserdefinedid2",
        "lastHeartbeatTime" : 1447182247
    },
    {
        "ip" : "testip2",
        "machine-uniqueid" : "testuuid",
        "userdefined-id" : "testuserdefinedid"
        "lastHeartbeatTime" : 1447182247
    }]
}

錯誤碼

除了返回Log Service API的通用錯誤碼,還可能返回如下特有錯誤碼:

HTTP狀態碼 ErrorCode ErrorMessage
404 GroupNotExist group {GroupName} not exist
500 InternalServerError internal server error

細節描述

該接口隻獲取與Server端連接正常的機器列表。

示例

請求示例:
GET /machinegroups/test-machine-group-5/machines?offset=0&size=3 HTTP/1.1
Header :
{
    "x-log-apiversion": "0.6.0",
    "Authorization": "LOG 94to3z418yupi6ikawqqd370:9yoK0iJPxr0RrWf/wW9NJYXu4zo=",
    "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
    "Date": "Tue, 10 Nov 2015 19:04:57 GMT",
    "Content-Length": "0",
    "x-log-signaturemethod": "hmac-sha1",
    "User-Agent": "sls-java-sdk-v-0.6.0",
    "Content-Type": "application/x-protobuf",
    "x-log-bodyrawsize": "0"
}
響應示例:
HTTP/1.1 200 OK
Header :
{
    "Date": "Tue, 10 Nov 2015 19:04:58 GMT",
    "Content-Length": "324",
    "x-log-requestid": "56423FD999248C827B000A57",
    "Connection": "close",
    "Content-Type": "application/json",
    "Server": "nginx/1.6.1"
}
Body :
{
    "machines":     [
        {
            "ip": "10.101.166.116",
            "machine-uniqueid": "",
            "userdefined-id": "",
            "lastHeartbeatTime": 1447182247
        },
        {
            "ip": "10.101.165.193",
            "machine-uniqueid": "",
            "userdefined-id": "",
            "lastHeartbeatTime": 1447182246
        },
        {
            "ip": "10.101.166.91",
            "machine-uniqueid": "",
            "userdefined-id": "",
            "lastHeartbeatTime": 1447182248
        }
    ],
    "count": 3,
    "total": 8
}

最後更新:2016-11-23 16:04:03

  上一篇:go RemoveConfigFromMachineGroup__Logtail機器組相關接口_API-Reference_日誌服務-阿裏雲
  下一篇:go GetAppliedConfigs__Logtail機器組相關接口_API-Reference_日誌服務-阿裏雲