Description
You can call this operation to query hosts.
Call description
Prerequisite
You have the HOST_VIEWER permissions.
Request path
GET /api/v2/compute/hosts
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| status | StringArray | No | ONLINE,NEW | The status of the host. Valid values: * NEW: The host is newly added without OCP-Agent and has not been initialized. * AVAILABLE: The host is online and available. * ONLINE: The host is online and the OCP-Agent service has been deployed on it. * OFFLINE: The host is offline. * DELETING |
| keyword | String | No | cluster1 | The keyword for searching for a host. Fuzzy match is supported. Valid values: * hostname: the name of the host. * innerIpAddress: the IP address of the host. * service: the service deployed on the host. |
| includedServiceType | StringArray | No | OB_CLUSTER,OB_PROXY | The service types included in the query. Valid values: * OB_CLUSTER * OB_PROXY * OCP_AGENT * BACKUP_AGENT * RESTORE_AGENT * BACKUP_RESTORE_AGENT * OMS |
| excludedServiceType | StringArray | No | OB_CLUSTER,OB_PROXY | The service types excluded in the query. Valid values: * OB_CLUSTER * OB_PROXY * OCP_AGENT * BACKUP_AGENT * RESTORE_AGENT * BACKUP_RESTORE_AGENT * OMS |
| page | Integer | No | 1 | The number of the page to return. Pages start from page 1. |
| size | Integer | No | 10 | The number of entries to return on each page. Maximum value: 2000. |
| sort | String | No | id,asc | The rule for sorting the requested data. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | The array of hosts. For more information about the data structure, see the following table. |
| ├─ page | Object | The page information. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Page parameters
| Parameter | Type | Description |
|---|---|---|
| totalElements | Integer | The total number of entries. |
| totalPage | Integer | The total number of pages. |
| number | Integer | The page number of the returned page. |
| size | Integer | The number of entries returned per page. |
Data structure of the host information
| Parameter | Type | Description |
|---|---|---|
| id | Long | The ID of the host. |
| name | String | The name of the host. |
| alias | String | The alias of the host. |
| description | String | The description of the host. |
| operatingSystem | String | The operating system. |
| operatingSystemRelease | String | The release name of the operating system. |
| architecture | String | The hardware architecture. |
| serialNumber | String | The serial number. |
| innerIpAddress | String | The IP address of the host. |
| sshPort | Integer | The SSH port number. |
| kind | String | The host category. Valid values: |
| publishPorts | String | The port mapping. |
| services | ObjectArray | The ServiceSummary array, which is a summary of the deployed services. |
| status | String | The status of the host. Valid values: * NEW: The host is newly added without OCP-Agent and has not been initialized. * AVAILABLE: The host is online and available. * ONLINE: The host is online and the OCP-Agent service has been deployed on it. * OFFLINE: The host is offline. * DELETING |
| idcId | Long | The ID of the IDC. |
| idcName | String | The name of the IDC. |
| idcDescription | String | The description of the IDC. |
| typeId | Long | The ID of the host type. |
| typeName | String | The name of the host type. |
| typeDescription | String | The description of the host type. |
| regionId | Long | The ID of the region. |
| regionName | String | The name of the region. |
| regionDescription | String | The description of the region. |
| hostAgentId | Long | The ID of the OCP-Agent. |
| hostAgentVersion | String | The version of the OCP-Agent. |
| hostAgentStatus | String | The status of the OCP-Agent. Valid values: * AVAILABLE * RESTARTING * STOPPING * REINTSTALLING * OFFLINE * DELETED |
| createTime | String | The time when the host was created. |
| updateTime | String | The time when the host was modified. |
Data structure of ServiceSummary
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the service. |
| version | String | The version of the service. |
| type | String | The type of the service. Valid values: * OB_CLUSTER * OB_PROXY * OCP_AGENT * BACKUP_AGENT * RESTORE_AGENT * BACKUP_RESTORE_AGENT * OMS |
| softwarePackageId | Long | The ID of the software package. |
Examples
Sample request
GET /api/v2/compute/hosts?page=1&size=10
Sample response
{
"data": {
"contents": [
{
"alias": null,
"architecture": "x86_64",
"createTime": "2021-08-10T11:56:16+08:00",
"description": null,
"hostAgentId": 6000001,
"hostAgentStatus": "AVAILABLE",
"hostAgentVersion": "3.1.2-20210812221645",
"id": 3000002,
"idcDescription": null,
"idcId": 1,
"idcName": "bejing1",
"innerIpAddress": "xx.xx.xx.xx",
"kind": "DEDICATED_PHYSICAL_MACHINE",
"name": "OceanBase152105.et15sqa",
"operatingSystem": "4.9.168-018.ali3000.alios7.x86_64",
"operatingSystemRelease": "alios7",
"publishPorts": null,
"regionDescription": null,
"regionId": 1,
"regionName": "beijing",
"serialNumber": null,
"services": [
{
"name": "cluster01:1",
"softwarePackageId": null,
"type": "OB_CLUSTER",
"version": "2.2.76"
}
],
"sshPort": 22,
"status": "ONLINE",
"typeDescription": null,
"typeId": 1,
"typeName": "beijing",
"updateTime": "2021-08-25T15:09:53+08:00"
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 1,
"totalPages": 1
}
},
"duration": 31,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T17:19:47.311+08:00",
"traceId": "7afbe6e4d7ad403b"
}