Generic REST Service Integration with NetDiagnostics

This section provides a brief description about the process of integrating generic REST service with NetDiagnostics Enterprise (NDE).

Purpose

The purpose of this document is to help a user know the process of providing an NDE service and how that service is utilized by generic REST service. The user would need to know only the Uniform Resource Locator (URL) of the server where the data is stored. The server, after processing the request, converts the content into the JSON information and sends it back to the caller.

Generating a URL

To create a URL of the server, user needs to specify the following parameters:

Host Name / IP Address

Specify the Host Name/IP address along with the port of the server. Also, specify the server path.

For example: http://10.10.50.17/DashboardServer/web/dev/checkGraphDatav3?

Start Date-Time and End Date-Time

Specify the Start Date-Time and End Date-Time of the sample data in mm/dd/yyyy hh:mm:ss format.

For example: startTime=04/25/2018%2020:00:00&endTime=04/25/2018%2021:00:00

Test Run

This is an optional input. The user needs to specify the configured NDE continuous Test run number.

Group ID and Graph ID

Group ID and Graph ID are always numeric. Graphs belong to a specific group. The user must know the group name to obtain Group ID and Graph ID. A graph ID is the exact name of a graph, which is already mapped in generic REST service.

To obtain Group ID and Graph ID, the user needs to make an ND REST call. For example:

http://10.10.50.17/DashboardServer/web/dev/getGroupIdGraphIdFromGroupNameAndGraphName?testRun=11170&groupName=SysStatsLinuxExt&graphName=CPU%20Utilisation

The output of above REST call is 10108,18 where Group ID is 10108 and Graph ID is 18 (these are separated by a comma in the output).

The user can also obtain Group ID and Graph ID by making a public ND REST call. For example:

https://65.19.151.240:4433/DashboardServer/web/dev/getGroupIdGraphIdFromGroupNameAndGraphName?testRun=11111&groupName=%20Business%20Transactions&graphName=Requests%20per%20sec

The output of above REST call is 10245,1 where Group ID is 10245 and Graph ID is 1 (these are separated by a comma in the output).

Vector Name

Specify the vector (Tier) name for which data is to be retrieved. This can be pattern based or a complete vector, and must be same as in GDF file.

Example: If the complete vector is ‘AppTier>QAServer2’, the user can retrieve data for the pattern by providing vector name as ‘AppTier*’, or the user can retrieve data for the specific vector by providing vector name as ‘QAServer2’.

Mode

‘Mode’ decides for RTG files read mode. The value must always be 2 (which means normal RTG files). The value of Modes can be from 1 to 4, but for generic REST service, use only 2.

isPattern

This gets the data based on vector pattern. We use generic REST service for derived graphs, so the value of this parameter needs to be ‘true’.

incDistGraphs

This is used with the ‘isPattern’ parameter. It gets the data of those graphs that are deleted in specified time period.

derFormula

It is the ‘Derived Formula’ which is mapped for graphs. For example: (MIN, MAX, AVG, NORAVG, SUM)

isAggr

The default value of this parameter is ‘false’, in which case sample wise data is calculated. If ‘true’ is selected, aggregated data is calculated.

NoteMultiple groups and graphs are not supported currently as this may cause performance issues.

Token

An authentication token is required to be passed in the URL. The user can generate a token via Generate Token option in NetDiagnostics.



The user is required to provide the time duration (in HH:MM format) after which the token is expired and click the Generate button.

For Example: n8H9DwcZQzBgOmp%2FaA8XBjGPAs5tUBF%2F0Mdmox7KILzp8k5F4ldHLSnj9uabP0ErV1Kdxtw%2FMUiVuOi8R43bkC
4Q0pmPFwlRNiKGScKZ%2FdVf5En4QQuP57CwchC1Ea1HWxrMiPj8tCCVvFiYKK82EfbU98LOLD%2F%2Fn5E6FLBFMDM%3D


Sample URL

A sample URL consisting of the parameters mentioned in the above section looks like the following:

https://65.19.151.240:4433/DashboardServer/web/dev/checkGraphDatav3?startTime=08/05/2019%2004:00:00&endTime=08/05/2019%2005:00:00&groupId=10245&graphId=1&vectorName=Cavisson%3EOverall%3E
Overall%3EAllTransactions&mode=2&isPattern=true&derFormula=AVG&isAggr=true&token=jbXBeIpOPtzdskwT30TGOniGPE9bcdRy63sQ%2BCJ81FeADGTMGranvdrB4fBffk2eIFun59bXoczlFcVlnDc0bzJvh
mbo5%2F4LVmdIxghvxIq04%2Fk%2FrxLqO82jZk3fd798EIsf7Ca6y9mnibFQLzuu%2Bk2JOwTuvcHtXTsLXUhiO%2FM%3D

Result:

{“Total_Packets”:60,”Start Time”:”08/05/2019 04:00:00″,”End Time”:”08/05/2019 05:00:00″,”Cache_INFO”:”Current Position = 0, Start Position = 1, MaxPackets = 61″,”Mode”:2,”data”:[{“sampleValue”:”0.309″}]}

Generating Response in JSON

Once the URL is specified, the user can generate the response in JSON format. To generate the response, specify the URL at any browser and press ENTER. The response is generated and displayed.

Formatting the Response

The response generated can be formatted by using any JSON editor (for example, https://jsoneditoronline.org/).

Once the response is formatted, it is easy to view the response details. The user needs to click expand icon to expand a node and collapse icon to collapse it.

Best Practices

A user can follow the below mentioned best practices for better API usage:

  • APIs perform well initially, but can degrade over time. Often, APIs come back within milliseconds initially, but over time, as complexity increases, they start to become slow. Therefore, to avoid slowness of the system API calls should be made within 15 minutes.
  • An authentication token is mandatory to be passed in the URL.