Retrieving Historical Data of a Measure

To figure out whether the target environment is functioning without any glitches, more often than not, administrators tend to monitor the performance of certain key measures over a period of time. Using the eG REST API, administrators are befitted in monitoring the performance of the measures over a period of time without logging into the eG console. The table below specifies the parameters that should be used to retrieve the historical data of the measures.

URL: http://<eG manager IP:port>/api/eg/analytics/getHistoricalData

Method: POST

Content-Type: application/json

Inputs to be Specified
Parameters Key values Example

Headers

managerurl: Base URL of the eG Manager i.e., http://<IP address of the eG console:Port>

user: eG username or domain/eG username

pwd: Base64 encoded password

{

"timeline":"1 hour",

"componentName":"TEZ-MSSQL-DB:1433",

"componentType":"Microsoft SQL",

"test":"Network",

"measure":"Packet Loss"

}

Example for retrieving historical data of a measure pertaining to an Oracle Database Server:

{

"timeline":"1 day",

"componentType":"Oracle Database Server"

"componentName":"Oradb:1521:egora",

"test":"Oracle Sessions",

"measure":"Active Sessions"

}

Body

Default:

{

"timeline":"Timeline for retrieving the measure data (in hours/days/weeks)",

"componentName":"Hostname of the component:Port/Null",

"componentType":"Component Type",

"test":"Test name",

"measure":"Measure name",

"showDisplayName":true/false"

}

If current measures of the Oracle Database server is to be retrieved, then the Key values should be specified as follows:

{

"timeline":"Timeline for retrieving the measure data (in hours/days/weeks)",

"componentName":"Hostname of the component:Port:SID",

"componentType":"Component Type",

"test":"Test name",

"measure":"Measure name",

"showDisplayName":true/false"

}

 

Success Response
Type Code Example Response

JSON

200

{

"Network": [

{

"date": "Sep 01, 2022 17:15:50",

"value": "100"

},

{

"date": "Sep 01, 2022 17:22:44",

"value": "100"

},

.

.

.

]

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{"code": 401,"error": "Invalid username or password"}

JSON

400 BAD REQUEST

You may receive one of the following responses:

{"code": 400,"error": " Bad Request. Header parameters : Username or Password or Manager Url is missing"} (or)

{"code": 400,"error": " Bad Request. Manager Url,Username,password is not provided"} (or)

{"code": 400,"error": " Bad Request. Please refer EG REST API documentation and add required parameters for this API."} (or)

{"code": 400,"error": "Component Name or Component Type or Measure or Test or Timeline is not provided"} (or)

{"code": 400,"error": "Component not associated with this user"} (or)

{"code": 400,"error": "No components associated for this user"} (or)

{"code": 400,"error": "Provide a space between value and unit in Timeline"} (or)

{"code": 400,"error": "The test is not available with this component type"} (or)

{"code": 400,"error": "Invalid Timeline. Please refer EG REST API documentation for this API"}

JSON

500 Server Error

{"code": 500,"error": " Server Error "}

Figure 1 : Retrieving historical data of a measure using Postman REST Client

Retrieving Historical Data of a Measure using cURL

To retrieve the historical data of a measure using cURL, the command should be specified in the following format:

curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getHistoricalData" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "managerurl:http://<eG Manager IP:Port>" -H "Content-Type:application/json" --data-raw "{\"timeline\":\"Timeline for retrieving the measure data (in hours/days/weeks)\",\"componentType\":\"Component Type\",\"componentName\":\"Component name:Port\",\"test\":\"Test name\",\"measure\":\"Measure name\"}"

Figure 2 shows an example of retrieving the current measures of a component using cURL.

Figure 2 : Retrieving historical data of a measure using cURL