マシン グループに属し、サーバーに接続されているマシンの状態を取得します。
例:
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 (最大値) です。 |
ListMachineGroup API には特別なレスポンスヘッダーはありません。 Log Service API のパブリックリクエストヘッダーの詳細については、「パブリックリクエストヘッダー」をご参照ください。
レスポンスヘッダーListMachineGroup API には特別なレスポンスヘッダーはありません。 Log Service API のパブリックレスポンスヘッダーの詳細については、「パブリックレスポンスヘッダー」をご参照ください。
レスポンス要素名前 | データ型 | 説明 |
---|---|---|
Count | Int | 返されるマシンの数 |
total | int | マシンの合計数 |
machines | json array | 返されるマシングループの名前一覧 |
マシンの説明
名前 | データ型 | 説明 |
---|---|---|
ip | string | マシンの IP アドレス |
マシン固有 | string | マシンの DMI UUID |
userdefined-id | String | マシンのユーザー定義 ID |
{
"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 の 一般的なエラー コード の他に、 ListMachines API から次の特別のエラー コードが返される場合があります。
HTTP ステータスコード | エラーコード | エラー メッセージ |
---|---|---|
404 | GroupNotExist | group {GroupName} が存在しません。 |
500 | InternalServerError | 内部サーバーエラー |
注 この API は、通常サーバーに接続されているマシンの一覧のみを取得します。
例
リクエスト例:
GET /machinegroups/test-machine-group-5/machines? offset=0&size=3 HTTP/1.1
Header :
{
"x-log-apiversion": "0.6.0",
"Authorization": "LOG <yourAccessKeyId>:<yourSignature>",
"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
}