ListMachines

Last Updated: Apr 19, 2017

Gets the status of your server-connected machines in the specified machine group.

Example:

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

  1. GET /machinegroups/{groupName}/machines HTTP/1.1
  2. Authorization: <AuthorizationString>
  3. Date: <GMT Date>
  4. Host: <Project Endpoint>
  5. x-log-apiversion: 0.6.0
  6. x-log-signaturemethod: hmac-sha1

Request parameters

URL parameters:

Name Type Required Description
groupName string Yes Name of the machine group
offset int No Start position of the returned results. The default value is 0.
size int No Maximum number of entries returned per page. The default value is 500 (maximum).

Request header

No special request header is available. For details about the public request header of the log service API, refer to Public Request Header.

Response header

No special response header is available. For details about the public response header of the log service API, refer to Public Response Header.

Response element

Name Type Description
count int The number of returned machines
total int Total number of machines
machines json array List of returned machines

Machines are described as follows:

Name Type Description
ip string Machine IP
machine-uniqueid string Machine DMI UUID
userdefined-id string Custom ID of the machine
  1. {
  2. "count":10,
  3. "total":100,
  4. "machines":
  5. [{
  6. "ip" : "testip1",
  7. "machine-uniqueid" : "testuuid1",
  8. "userdefined-id" : "testuserdefinedid1",
  9. "lastHeartbeatTime" : 1447182247
  10. },
  11. {
  12. "ip" : "testip1",
  13. "machine-uniqueid" : "testuuid2",
  14. "userdefined-id" : "testuserdefinedid2",
  15. "lastHeartbeatTime" : 1447182247
  16. },
  17. {
  18. "ip" : "testip2",
  19. "machine-uniqueid" : "testuuid",
  20. "userdefined-id" : "testuserdefinedid"
  21. "lastHeartbeatTime" : 1447182247
  22. }]
  23. }

Error code

In addition to general error codes of the log service API, the following special error codes may be returned:

HTTP Status Code ErrorCode Error Message
404 GroupNotExist group {GroupName} not exist
500 InternalServerError internal server error

Detailed description

Only the list of machines in normal connection with the server can be obtained at this interface.

Example

Request example:
  1. GET /machinegroups/test-machine-group-5/machines?offset=0&size=3 HTTP/1.1
  2. Header :
  3. {
  4. "x-log-apiversion": "0.6.0",
  5. "Authorization": "LOG 94to3z418yupi6ikawqqd370:9yoK0iJPxr0RrWf/wW9NJYXu4zo=",
  6. "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
  7. "Date": "Tue, 10 Nov 2015 19:04:57 GMT",
  8. "Content-Length": "0",
  9. "x-log-signaturemethod": "hmac-sha1",
  10. "User-Agent": "sls-java-sdk-v-0.6.0",
  11. "Content-Type": "application/x-protobuf",
  12. "x-log-bodyrawsize": "0"
  13. }
Response example:
  1. HTTP/1.1 200 OK
  2. Header :
  3. {
  4. "Date": "Tue, 10 Nov 2015 19:04:58 GMT",
  5. "Content-Length": "324",
  6. "x-log-requestid": "56423FD999248C827B000A57",
  7. "Connection": "close",
  8. "Content-Type": "application/json",
  9. "Server": "nginx/1.6.1"
  10. }
  11. Body :
  12. {
  13. "machines": [
  14. {
  15. "ip": "10.101.166.116",
  16. "machine-uniqueid": "",
  17. "userdefined-id": "",
  18. "lastHeartbeatTime": 1447182247
  19. },
  20. {
  21. "ip": "10.101.165.193",
  22. "machine-uniqueid": "",
  23. "userdefined-id": "",
  24. "lastHeartbeatTime": 1447182246
  25. },
  26. {
  27. "ip": "10.101.166.91",
  28. "machine-uniqueid": "",
  29. "userdefined-id": "",
  30. "lastHeartbeatTime": 1447182248
  31. }
  32. ],
  33. "count": 3,
  34. "total": 8
  35. }
Thank you! We've received your feedback.