Retrieving Measure Graph
Using the eG REST API, you can retrieve the measure graph for a chosen measure during a chosen time period as an image with ".png" extension.
URL: http://<eG manager IP:port>/api/eg/analytics/getMeasureGraph
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 |
{ "componentName":"172.16.14.93:7077", "componentType":"eG Manager", "test":"System Details", "measure":"System CPU utilization", "info":"Processor_0_0", "timeline":"1 hour" } Example for retrieving current measures from an Oracle Database Server: { "componentName":"Oractest:1521:egora", "componentType":"Oracle Database Server" "test":"System Details", "measure":"System CPU utilization", "info":"Processor_0_0", "timeline":"1 hour" } Example for retrieving current measures from an Oracle Database Server for a chosen time period: { "componentName":"Oractest:1521:egora", "componentType":"Oracle Database Server" "test":"System Details", "measure":"System CPU utilization", "info":"Processor_0_0", "timeline":"Any", "startDate": "January 01, 2023 00:00:00", "endDate": "January 01, 2023 11:00:00" } |
Body |
Default: { "componentName":"Hostname of the component:Port", "componentType":"Component Type", "test":"Test name", "measure":"Measure name", "info":"Descriptor name", "timeline":"Timeline for retrieving the data (in hours/days/weeks/Any)" } If current measures of the Oracle Database server is to be retrieved, then the Key values should be specified as follows: { "componentName":"Hostname of the component:Port:SID", "componentType":"Component Type", "test":"Test name", "measure":"Measure name", "info":"Descriptor name", "timeline":"Timeline for retrieving the data (in hours/days/weeks/Any)" } |
|
Optional: { "test":"Test name", "measure":"Measure name". "info":"Descriptor name", "showDisplayName":"true/false", "startDate": "<Month Date,YYYY HH:MM:SS>", "endDate": "<Month Date,YYYY HH:MM:SS>" } |
Type | Code | Content |
---|---|---|
JSON |
200 |
Measure Graph as shown in Figure 1will be displayed. |
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 Test or Measure is not provided"} (or) {"code": 400,"error": "Bad Request. Please give start date and end date if timeline is Any. Please refer API documentation"} |
JSON |
500 Server Error |
{"code": 500,"error": " Server Error. Please check /manager/logs/error_log in the installation directory for more information. "} |
Figure 1 : Example to retrieve measure graph using Postman REST Client
Retrieving Measure Graph using cURL
To retrieve the measure graph of a chosen measure and descriptor during the chosen time period through the REST API using cURL, the command should be specified in the following format:
curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getMeasureGraph" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "managerurl:http://<eG Manager IP:Port>" –-data-raw "{\"componentType\":\"name of component Type\",\”componentName\":\"name of the component:Port\",\"test\":\"name of test\", \"measure\":\"name of measure\",\"info\":\"Descriptor name\",\"timeline\":\"Timeline for retrieving the graph (in hours/days/weeks/Any)\"}" -H "Content-Type:application/json"
Figure 2 shows an example of retrieving the measure graph for a chosen measure and descriptor using cURL.