Updated on 2025-02-13 GMT+08:00

Querying All Agents of an Application

Function

This API is used to query all Agents of an application.

URI

POST /v1/apm2/openapi/apm-service/agent-mgr/search

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

business_id

Yes

Long

Application ID.

env_id

No

Long

Environment ID.

status

No

String

Agent status.

Enumeration values:

  • online
  • disable
  • offline

region

Yes

String

Region name.

order_by_status

No

String

Whether to sort data by collection status. If this parameter is left blank, data is not sorted by status. If this parameter is set to y, data is sorted by status.

page

Yes

Integer

Number of the page to be queried. Minimum: 1.

page_size

No

Integer

Maximum number of records displayed on each page.

keyword

No

String

Keyword.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total_page

Integer

Total number of pages.

total_count

Integer

Total number of Agents.

online_count

Integer

Number of normal Agents.

offline_count

Integer

Number of Agents with abnormal heartbeats.

disable_count

Integer

Number of disabled Agents.

agent_info_list

Array of InstanceInfo objects

Agent address list.

Table 4 InstanceInfo

Parameter

Type

Description

instance_id

Long

Instance ID, which can be an input parameter for the API used to enable or disable collection for an instance.

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

Last heartbeat time, in milliseconds.

register_time

Long

Registration time, in milliseconds.

last_modify_user_id

String

ID of the user who last started or stopped the Agent.

instance_status

Integer

Instance status.

last_modify_user_name

String

Name of the user who last changed the instance status.

last_modify_time

Long

Last modification time, in milliseconds.

Example Requests

Query all Agents of application 6 in region .

/v1/apm2/openapi/apm-service/agent-mgr/search

{
  "region" : "",
  "page" : 1,
  "page_size" : 10,
  "business_id" : 6
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "total_page" : 1,
  "total_count" : 1,
  "online_count" : 1,
  "offline_count" : 0,
  "disable_count" : 0,
  "agent_info_list" : [ {
    "instance_id" : 5298,
    "business_name" : "LubanApm",
    "business_id" : null,
    "app_name" : "apm-data-deliver/",
    "host_name" : "szv*******1",
    "instance_name" : "default",
    "ip_address" : "*.*.*.*",
    "env_id" : 1105,
    "agent_version" : "2.1.16",
    "last_heartbeat" : 1669684246000,
    "register_time" : 1657762671000,
    "last_modify_user_id" : "70iWY********VHVd",
    "instance_status" : 0,
    "last_modify_user_name" : "yWX",
    "last_modify_time" : 1667839085000
  } ]
}

Status Codes

Status Code

Description

200

OK: The request is successful.

400

Bad Request: Semantic or parameter error.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.