Retrieving Monthly Trend Data

Using the eG REST API, administrators can retrieve the trend data of a chosen test/measure combination for a chosen timeperiod of one/more months. The table below specifies the URL and the parameters that should be used to retrieve the measures of the tests.

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

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

{

"test":"System Details",

"measure":"CPU utilization",

"componentName":"EGDP156",

"timeline":"2 Months"

}

Body

Default:

{

"test":"Test name",

"measure:":"Measure name",

"timeline":"time period specified in months i.e., 1 to 12 months or Any. Default is 1 Month"

}

Optional:

{

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

"info":"descriptor of the test",

"startDate":"start_date",

"endDate":"end_date"

}

 

Success Response
Type Code Content

JSON

200

[

{

"componentName": "EGDP156",

"test": "System Details",

"measure": "CPU utilization",

"measureUnit": "%",

"info": "Processor_0_3",

"timePeriod": "Nov 17, 2022 00:00:00 to Jan 18, 2023 00:00:00",

"data": [

{

"max": "72.2297",

"measurementTime": "Dec 01, 2022 00:00:00",

"min": "0.0092",

"avg": "6.3344"

}

]

},

{

"componentName": "EGDP156",

"test": "System Details",

"measure": "CPU utilization",

"measureUnit": "%",

"info": "Processor_0_2",

"timePeriod": "Nov 17, 2022 00:00:00 to Jan 18, 2023 00:00:00",

"data": [

{

"max": "70.9279",

"measurementTime": "Dec 01, 2022 00:00:00",

"min": "0.0",

"avg": "6.9078"

}

]

},

.

.

.

]

}

]

 

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. Header parameters : Manager URL, Username or Password is not provided"} (or)

{"code": 400,"error": "Unable to connect manager. Please verify manager URL and make sure that eG manager is running"} (or)

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

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

{"code": 400,"error": Please provide valid test name"} (or)

{"code": 400,"error": "Bad Request. Test is not associated for given Component"} (or)

{"code": 400,"error": "Bad Request. Please provide valid input data"} (or)

{"code": 400,"error": "Please provide valid measure name"} (or)

{"code": 400,"error": "Please provide valid timeline"} (or)

{"code": 400,"error": "Invalid Timeline. Please eG REST API documentation for this API"} (or)

{"code": 400,"error": "Timeline range is 1 to 24 hours. Please provide valid timeline"} (or)

{"code": 400,"error": "Invalid Timeline. Provide a space between value and unit in Timeline"}

JSON

500 Server Error

{"code": 500,"error": " Server Error. Please check REST API parameter values and also check /manager/logs/error_log or managererr.log in the eG manager installation directory for more information."}

Retrieving Monthly Trend Data of Measure Using Postman REST Client

Figure 1 : Retrieving monthly trend data of a chosen measure using Postman REST Client

Retrieving Monthly Trend Data using cURL

To retrieve monthly trend data of a test/measure combination using cURL, the command should be specified in the following format:

curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getMonthlyTrend" -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 "{\"test\":\"Test name\",\"componentName\":\"Name of Component\",\"measure\":\"measure name\",\"timeline\":\"time duration in months\"}"

Figure 2 shows an example to retrieve monthly trend data for a chosen measure during a chosen time duration using cURL.

Retrieving Monthly Trend Data of Measure Using cURL

Figure 2 : An example cURL output to retrieve the monthly trend data for a measure