Updated on 2023-08-02 GMT+08:00

Obtaining the Instance Information

Function

This API is used to obtain the instance information.

URI

POST /v1/apm2/openapi/view/mainview/get-env-instance-list

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

x-business-id

Yes

Long

Application ID.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

env_id

Yes

Long

Environment ID.

page

Yes

Integer

Current page number.

page_size

Yes

Integer

Number of records on each page.

keyword

No

String

Keyword.

status

No

Integer

Instance status.

return_count

No

Boolean

Whether to return the counting result.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

instance_info_list

Array of InstanceInfo objects

Instance information.

total_count

Integer

Number of instances.

online_count

Integer

Total number of online instances.

offline_count

Integer

Total number of offline instances.

disable_count

Integer

Total number of stopped instances.

Table 4 InstanceInfo

Parameter

Type

Description

instance_id

Long

Instance ID.

business_name

String

Application name.

business_id

Long

Application ID.

app_name

String

Component name.

host_name

String

Host name.

instance_name

String

Instance name.

ip_address

String

Host IP address.

env_id

Long

Environment ID.

agent_version

String

JavaAgent version.

last_heartbeat

Long

Time when the latest heartbeat message was received.

register_time

Long

Registration time.

last_modify_user_id

String

Latest user ID.

instance_status

Integer

Instance status.

last_modify_user_name

String

Latest username.

last_modify_time

Long

Last modification time.

Example Requests

Query the instance information list in environment 11.

/v1/apm2/openapi/view/mainview/get-env-instance-list

{
  "env_id" : "11",
  "page" : 1,
  "page_size" : 10
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "instance_info_list" : [ {
    "instance_id" : 15,
    "business_name" : null,
    "business_id" : null,
    "app_name" : null,
    "host_name" : "apm2-apm-pu-task-6b5bbfc84d-rxlhr",
    "instance_name" : "default",
    "ip_address" : "172.16.3.39",
    "env_id" : null,
    "agent_version" : "2.2.8",
    "last_heartbeat" : 1666682386000,
    "register_time" : 1666664387000,
    "last_modify_user_id" : null,
    "instance_status" : 0,
    "last_modify_user_name" : null,
    "last_modify_time" : 0
  }, {
    "instance_id" : 16,
    "business_name" : null,
    "business_id" : null,
    "app_name" : null,
    "host_name" : "apm2-apm-pu-task-6b5bbfc84d-gtrrs",
    "instance_name" : "default",
    "ip_address" : "172.16.3.7",
    "env_id" : null,
    "agent_version" : "2.2.8",
    "last_heartbeat" : 1666682377000,
    "register_time" : 1666664436000,
    "last_modify_user_id" : null,
    "instance_status" : 0,
    "last_modify_user_name" : null,
    "last_modify_time" : 0
  } ],
  "total_count" : 2,
  "online_count" : 0,
  "offline_count" : 0,
  "disable_count" : 0
}

Status Codes

Status Code

Description

200

OK: The request is successful.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.