Brief introduction:ARMS enterprise-level scenarios are described in the integration scenario

According to the best practices, you can see that ARMS OpenAPI can be flexibly integrated into customer link monitoring scenarios and display monitoring information visually and graphically.

1. Background information

Application Real-time Monitoring Service (ARMS) is an Application performance management product that enables you to implement full-stack performance Monitoring and end-to-end whole-link tracing and diagnosis, improving Application o&M efficiency.

This best practice is based on the form of calling ARMS OpenAPI to realize the visual graphical display of link monitoring of customer application scenarios. The environment is ASCM console of proprietary cloud V3.10 version, and the test is conducted by calling ARMS OpenAPI through Postman tool. In the second chapter, the test environment and test tools are introduced in detail. Chapter 3 describes the calling process through a query of all application ARMS OpenAPI interfaces, and includes the list of parameter interfaces that the interface needs to request. In the last chapter, the ARMSOpenAPI interface is used to obtain link monitoring information in a complex application scenario, and the list fields of each interface, the invocation procedure, and the return result are described in detail.

Best practice value

By calling the use of ARMS OpenAPI in application scenarios, readers can intuitively understand the capabilities of ARMS products. In addition, ARMS provides a set of OpenAPI that can be easily integrated into customer applications and quickly realize the complex microservice link monitoring capability. The scope of ARMS monitoring service capability is relatively wide. Contains browser, small program, APP, distributed application and container environment, so the complete monitoring capability, the development process does not need to integrate the form of multiple open source components, so that the microservice program monitoring function development is simple, so that the application operation and maintenance becomes easy.

2. Environmental

Before using ARMS, you need to check the current system environment as follows.

This best practice is based on proprietary Cloud enterprise version V3.10.0 of ARMS.

Note: The versions of ARMS OpenAPI do not change much and use the same, so this document is also applicable to public cloud products or private cloud V3.7.0 and above. Proprietary cloud V3.10.0 console is called ASCM, and earlier versions of V3.10.0 are Apsara Stack.

1. Log in to the ASCM console.

2. On the navigation bar, point to the product and click EDAS.

Figure 1: ASCM

Description: Because ARMS monitors application data, EDAS products are required. In this test, a standard Spring Boot application is deployed through EDAS, ARMS monitoring is enabled, and monitoring data is obtained.

Figure 2: EDAS console

Figure 3: The ARMS console

3. Check the test tools.

This practice will create a Win64 VM in a private cloud environment and then install Postman on the VM for testing.

Figure 4: The Postman test

3. Open API usage

Call URL confirmation

OpenAPI interfaces are REST services. First, verify the URL of the service. The domain name of each private cloud environment is different, which results in different urls. Modify the URL information based on the specific environment. The prefix and port number remain the same. [http://arms.console.example.com:8099/](http://arms.console.example.com:8099/)

The name of the interface
API data sets /dataset/GeneralQuery.json
Key application performance indicators /metric/Metric.json
The alarm information There is no
Application monitoring – Application topology /trace/Dependecies.json
Event set /eventset/EventList.json

Call examples – View all applications:

API specification

URL: [http://arms.console.example.com:8099/trace/Services.json] (http://arms.console.example.com:8099/trace/Services.json)

The list of parameters

The field names The field type Field meaning Whether the choice note
\_userId String The user id is User name (e.g. Arms \_admin)

Return format example

{"code": 200, "data": {"details": [{"pid": "string", "regionId": "string", "serviceName": "details": [{"pid": "string", "regionId": "string", "serviceName": "Services ":[// application name list "string", "string"]}, "success": true}

Postman calls the result

Parameter Settings: \_userId= 121827433423****

Figure 5: Postman call result

4. Application Description

The application topology data, curve diagram, and application monitoring indicator data obtained from ARMS are displayed on the large-screen DataV.

Figure 6: DataV display

5. Query the number of interface calls

The /metric/ metry. json interface is used to obtain application-related performance data and query the number of interface calls.

API specification

  • URL:[http://arms.console.example.com:8099/metric/Metric.json](http://arms.console.example.com:8099/metric/Metric.json)
  • Interface description:
The field names The field type Field meaning Whether the choice note
startTime Long Start time for querying data is There is no
endTime Long End time for querying data is There is no
intervalInSec Integer The time interval no Advice to fill in
metric String The metric field is Fill in details. Refer to the parameter filling demonstration
filters List[String] Filter fields is Fill in details. Refer to the parameter filling demonstration
measures List[String] indicators is Fill in details. Refer to the parameter filling demonstration
dimensions List[String] The dimension is Fill in details. Refer to the parameter filling demonstration
orderBy String Sort field no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC)
limit Integer Returns the number of no There is no
\_userId String The user id is User name (e.g. Arms \_admin)

Invoke the sample

Example Query the number of interface calls of a specified application in the past 7 days

Parameter setting example:

The field names The field type Field meaning Will choose The sample value Source of value
startTime Long Start time for querying data is 1578199319898 The system time
endTime Long End time for querying data is 1578804119898 The system time
intervalInSec Integer The time interval no The default value is 3600 seconds, that is, 1 hour Set manually
metric String The metric field indicates the metric to be queried is APPSTAT.DETAIL Set manually
filters List[String] Filter fields, strictly according to format, otherwise call error is [{key=pid,value=1218274334230390@db61f75c2f******},{key=regionId,value=cn-******-d01}] Pid and RegionID are from a proprietary cloud environment
measures List[String] indicators is [rt,count,error,errrate] The API documentation
dimensions List[String] The dimension is [pid,rpcType,rootIp] The API documentation
orderBy String Sort field no There is no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC) There is no
limit Integer Returns the number of no There is no There is no
\_userId String The user id is 121827433423 * * * * There is no

The query results

Parameter Settings:

Figure 7: Parameter Settings

Results:

  • The result is a JSON data set.
  • The data set indicates the query status. 200 is returned on success, and an error code and reason are returned on failure. Typical errors such as missing required parameters, authentication errors, etc. (because the filters parameter is not formatted as required).
  • The organization of the result set returned by OpenAPI is related to the start time, end time, and data interval of the query data. This query is for the last 7 days, and the data interval is set to 24 hours, so the result set returns a set of 7 “data”.
  • Count:0.0 PID: rpcDesc; rpcType:0;
  • Adjusting the start, end, and interval of the query will affect the number of data items. Adjusting interface query parameters will affect the data in each data item.
  • If you need to calculate some aggregate value, such as the total number of HTTP calls over the past 7 days, you need to add up the multiple pieces of data yourself.

6. Query the number of exceptions

Use the /metric/ metry. json interface to obtain application performance data and query the number of exceptions.

API specification

  • URL:[http://arms.console.example.com:8099/metric/Metric.json](http://arms.console.example.com:8099/metric/Metric.json)
  • Interface description:
The field names The field type Field meaning Whether the choice note
startTime Long Start time for querying data is There is no
endTime Long End time for querying data is There is no
intervalInSec Integer The time interval no Advice to fill in
metric String The metric field is Fill in details for reference below
filters List[String] Filter fields is Fill in details for reference below
measures List[String] indicators is Fill in details for reference below
dimensions List[String] The dimension is Fill in details for reference below
orderBy String Sort field no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC)
limit Integer Returns the number of no There is no
\_userId String The user id is User name (e.g. Arms \_admin)

Invoke the sample

Example Query the number of interface calls of a specified application in the past 7 days.

Parameter setting example:

The field names The field type Field meaning Will choose The sample value Source of value
startTime Long Start time for querying data is 1577980826988 The system time
endTime Long End time for querying data is 1578585626989 The system time
intervalInSec Integer The time interval no The default value is 3600 seconds, that is, 1 hour Set manually
metric String The metric field indicates the metric to be queried is APPSTAT.EXCEPTION Set manually
filters List[String] Filter fields, strictly according to format, otherwise call error. is [{key=pid,value=1218274334230390@db61f75c2f******},{key=regionId,value=cn-******-d01}] Pid and RegionID are from a proprietary cloud environment
measures List[String] indicators is [count] The API documentation
dimensions List[String] The dimension is [pid,rpc,endpoint,exceptionInfo] The API documentation
orderBy String Sort field no There is no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC) There is no
limit Integer Returns the number of no There is no There is no
\_userId String The user id is 1218274334230390 There is no

The query results

Parameter Settings:

Figure 8: Parameter Settings

Query result:

Figure 9: Query results

Results:

  • The result is a JSON data set.
  • The data set indicates the query status. 200 is returned on success, and an error code and reason are returned on failure. Typical errors such as missing required parameters, authentication errors, etc. (because the filters parameter is not formatted as required).
  • No relevant data is found in this query, so the number of exceptions is 0.

7. Query the number of application instances

Use the /metric/ metric. Json interface to obtain application-related performance data and query the number of current application instances.

API specification

  • URL:[http://arms.console.example.com:8099/metric/Metric.json](http://arms.console.example.com:8099/metric/Metric.json)
  • Interface description:
The field names The field type Field meaning Whether the choice note
startTime Long Start time for querying data is There is no
endTime Long End time for querying data is There is no
intervalInSec Integer The time interval no Advice to fill in
metric String The metric field is Fill in details for reference below
filters List[String] Filter fields is Fill in details for reference below
measures List[String] indicators is Fill in details for reference below
dimensions List[String] The dimension is Fill in details for reference below
orderBy String Sort field no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC)
limit Integer Returns the number of no There is no
\_userId String The user id is User name (e.g. Arms \_admin)

Invoke the sample

Example Query the number of interface calls of a specified application in the past 7 days.

Parameter setting example:

The field names The field type Field meaning Will choose The sample value Source of value
startTime Long Start time for querying data is 1577980826988 The system time
endTime Long End time for querying data is 1578585626989 The system time
intervalInSec Integer The time interval no The default value is 3600 seconds, that is, 1 hour Set manually
metric String The metric field indicates the metric to be queried is APPSTAT.DETAIL Set manually
filters List[String] Filter fields, strictly according to format, otherwise call error. is [{key=pid,value=1218274334230390@db61f75c2f28609},{key=regionId,value=******}] Pid and RegionID are from a proprietary cloud environment
measures List[String] indicators is [count] The API documentation
dimensions List[String] The dimension is [pid,rootIp] The API documentation
orderBy String Sort field no There is no There is no
sortOrder String The sorting no Default unsorted (ASC or DESC) There is no
limit Integer Returns the number of no There is no There is no
\_userId String The user id is 12182743342 * * * * * * There is no

The query results

Parameter Settings:

Figure 10: Parameter Settings

Query result:

Figure 11: Query results

Results:

  • The result is a JSON data set.
  • The data set indicates the query status. 200 is returned on success, and an error code and reason are returned on failure. Typical errors such as missing required parameters, authentication errors, etc. (because the filters parameter is not formatted as required).
  • The organization of the result set returned by Openapi is related to the start time, end time, and data interval of the query data. This query is for the last 7 days, and the data interval is set to 24 hours, so the result set returns a set of 7 “data”.
  • Each data includes the queries specified in measure and Dimension. In this result set, for example, this includes: Count:0.0 RootIP
  • The query requirement is to see how many instances are deployed in this application. Therefore, the number of instances can be calculated by calculating the different IP addresses in the result. Another method is to set the value of intervalInSec and make it wait for the interval of the query, so that the number of entries in the resulting data set is the number of instances, because each IP will have one entry.

8. Query the current application topology

The /trace/Dependecies. Json interface is used to obtain the application topology data.

API specification

  • URL:[http://arms.console.example.com:8099/trace/Dependecies.json](http://arms.console.example.com:8099/trace/Dependecies.jso n)
  • Interface description:
The field names The field type Field meaning Whether the choice note
startTime Long Start time for querying data is There is no
endTime Long End time for querying data is There is no
\_userId String The user id is User name (e.g. Arms \_admin)
type String Types of queries is To query ALL relationships, use ALL; Single application relationships using apps
pid String Apply the corresponding PID no This parameter is mandatory when type=APP

Invoke the sample

Example Query the number of interface calls of a specified application in the past 7 days.

Parameter setting example:

This test was conducted on January 12, and the data of the past 7 days were queried.

The field names The field type Field meaning Will choose The sample value
startTime Long Start time for querying data is 1578199319898 (5 January)
endTime Long End time for querying data is 1578804119898 (12 January)
\_userId String The user id is 1218274334 * * * * * *
type String Types of queries is APP
pid String Apply the corresponding PID no 1218274334230390@db61f75c******

The query results

Parameter Settings:

Figure 12: Parameter Settings

Query result:

{" code ": 200," data ": {" link" : [{" code ": 200," data ": {" link" : [{" callCount ": 26997.0," the child ": "Demo-Service", "childNodeId": 731107445, "childPid": "1218274334230390@db61f75c2******", "elapsed": 16.2328, "errorCount": 16.0, "parent": "USER", "parentNodeId": 812148234, "parentPid": "1218274334230390@db61f75c2******", "protocol": "HTTP"}, {"callCount": 8.0, "child": "ChildNodeId ": -1762019072, "childPid":" PDSA_lHH_rocketMQ ", "Elapsed ": 11190.5, "errorCount": 8.0, "parent": "dem-service ", "parentNodeId": 731107445, "parentPid": "1218274334230390@db61f75c2******", "protocol": "AliWareMQ}]," "nodes" : [{" elapsed ": 0.0," errorCount ": 0.0," id ", 812148234, "name" : "USER", "pid" : "1218274334230390 @ db61f75c2 * * * * * *", "requestCount" : 0.0, "type" : "USER"}, {" elapsed ": 0.0," errorCount ": 0.0," id ": 731107445, "name": "demo-service ", "pid": "1218274334230390@db61f75c2******", "requestCount": 0.0, "type": "MQ_PRODUCER"}, {" elapsed ": 0.0," errorCount ": 0.0," id ": - 1762019072," name ":" * * * * _rocketmq pdsa_ ", "pid" : "Pdsa_ _rocketmq * * * *", "requestCount" : 0.0, "type" : "METAQ"}}], "success" : true}

The actual topology is as follows:

Figure 13: Topology

Results:

  • The result is a JSON data set.
  • The data set indicates the query status. 200 is returned on success, and an error code and reason are returned on failure. Typical errors such as missing required parameters, authentication errors, etc. (because the filters parameter is not formatted as required).
  • The query result is the node data and connection data of a dot plot, and the user needs to assemble the corresponding data according to the chart control.

We are the Ali Cloud intelligent global technology service -SRE team, we are committed to become a technology-based, service-oriented, ensure the high availability of business system engineer team; We provide professional and systematic SRE services to help our customers better use the cloud, build more stable and reliable business systems based on the cloud, and improve the stability of the business. We expect to be able to share more to help enterprise customers on the cloud, with the cloud, so that customers on the cloud business operation more stable and reliable technology, you can nail scan below the QR code, join ali Cloud SRE Technical College nail circle, and more cloud people exchange those things about the cloud platform.

Copyright Notice:The content of this article is voluntarily contributed by real-name registered users of Ali Cloud, and the copyright belongs to the original author. Ali Cloud developer community does not own the copyright, and does not bear the corresponding legal responsibility. For specific rules, please refer to the “AliYun Developer Community User Service Agreement” and “AliYun Developer Community Intellectual Property Protection Guidelines”. If you find any suspected plagiarized content in this community, please fill in the infringement complaint form to report. Once verified, the community will immediately delete the suspected infringing content.