Retrieving Daily 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 days/weeks. 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/getDailyTrend
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", "timeline":"1 day" } |
Body |
Default: { "test":"Test name", "measure:":"Measure name", "timeline":"time period specified in days/weeks i.e., 1 to 7 days or 1 to 4 weeks. Default is 1 day" } |
|
Optional: { "componentName":"Hostname of the component:Port:SID", "info":"descriptor of the test" ", } |
Type | Code | Content |
---|---|---|
JSON |
200 |
[ { "componentName": "CTXCONNECTSRV2", "test": "System Details", "measure": "CPU utilization", "measureUnit": "%", "info": "Processor_0_1", "timePeriod": "Jan 17, 2023 00:00:00 to Jan 18, 2023 00:00:00", "data": [ { "max": "-", "measurementTime": "Jan 17, 2023 00:00:00", "min": "-", "avg": "-" } ] }, . . . } ] |
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 30 days. Please provide valid timeline"} (or) {"code": 400,"error": "Invalid Timeline. Provide a space between value and unit in Timeline"} (or) {"code": 400,"error": "Timeline range is 1 to 4 weeks. Please provide valid timeline"} (or) |
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 measureon a chosen day using Postman REST Client
Retrieving Daily Trend Data using cURL
To retrieve daily trend data of a test using cURL, the command should be specified in the following format:
curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getDailyTrend" -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\",\"measure\":\"measure name\",\"timeline\":\"time duration in days/weeks\"}"
Figure 2 shows an example to retrieve the trend data for a chosen measure for a time period of a day using cURL.
Figure 2 : An example cURL command to retrieve the daily trend data for a measure
Figure 3 shows a sample output that retrieves the daily trend data for a chosen measure of a chosen test reported by eG Enterprise using cURL.
Figure 3 : Sample output with the daily trend data for a chosen measure of a chosen test