Retrieving Hourly Trend Data
Using the eG REST API, administrators can retrieve the trend data of a chosen test/measure combination for a chosen component type and chosen timeperiod of one/more hours. 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/getHourlyTrend
Method: POST
Content-Type: application/json
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":"Tez-SyBase", "timeline":"2 hours" } |
Body |
Default: { "test":"Test name", "measure:":"Measure name", "timeline":"time period specified in hours i.e., 1 to 24 hours. Default is 1 hour" } |
|
Optional: { "componentName":"Hostname of the component:Port:SID", "info":"descriptor of the test" } |
Type | Code | Content |
---|---|---|
JSON |
200 |
[ { "componentName": "Tez-SyBase", "test": "System Details", "measure": "CPU utilization", "measureUnit": "%", "info": "Processor_0_1", "timePeriod": "Jan 17, 2023 22:00:00 to Jan 18, 2023 00:00:00", "data": [ { "max": "41.2497", "measurementTime": "Jan 17, 2023 23:00:00", "min": "0.022", "avg": "12.2201" }, { "max": "24.065", "measurementTime": "Jan 17, 2023 22:00:00", "min": "0.5587", "avg": "8.5863" } ] }, . . . ] } ] |
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 refer 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."} |
Figure 1 : Retrieving trend data of a chosen measure and chosen hour using Postman REST Client
Retrieving Hourly Trend Data using cURL
To retrieve trend data of the tests using cURL, the command should be specified in the following format:
curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getHourlyTrend" -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\",\"info\":\"Descriptor name\",\"measure\":\"measure name\",\"timeline\":\"time duration in hours\"}"
Figure 2 shows an example and a sample putput that retrieves the hourly trend data for a chosen measure during a chosen time duration using cURL.
Figure 2 : An example cURL command to retrieve thehoruly trend data for a measure