Retrieving the Details of Components Associated with a Segment

For each segment created on eG Enterprise, administrators can use the eG REST API to retrieve the components associated with the segment. The details of components such as the total number of components, name of the component and their severity can be retrieved. The URL can be specified in the following format:

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

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

{

"segment" : "SENTHIL-DATABASE.Segments"

}

Body

{

"segment” : "name of segment"

}

 

 

Success Response
Type Code Content

JSON

200

{

"total": 15,

"summary": [

{

"critical": 12,

"color": "#cd0f0f"

},

{

"major": 1,

"color": "#fa9d1c"

},

{

"minor": 2,

"color": "#ccc100"

},

{

"unknown": 0,

"color": "#30a1d9"

},

{

"normal": 0,

"color": "#0c9a12"

}

],

"details": [

{

"componentName": "COUCHDB_10.73:5984",

"priority": "critical",

"componentType": "Apache CouchDB"

},

{

"componentName": "MariaDB_10.73:3306",

"priority": "critical",

"componentType": "Maria Database"

},

{

"componentName": "SQL_10.36:1433",

"priority": "critical",

"componentType": "Microsoft SQL"

},

{

"componentName": "SQL_Cluster_10.51:1433",

"priority": "critical",

"componentType": "Microsoft SQL Cluster"

},

.

.

.

]

}

 

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": "Please give Segment name. "}

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

JSON

500 Server Error

{"code": 500,"error": " Server Error. Please check /manager/logs/error_log in the installation directory for more information."}

 

Figure 1 : Retrieving the details of components associated with a segment using Postman REST Client

Retrieving Details of Components Associated with Segments using cURL

To retrieve the details of the components associated with a segment added on eG Enterprise using cURL, the command should be specified in the following format:

curl -L -X POST "http://<eG Manager IP:Port>/api/eg/analytics/getSegmentDetails" -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 "{\"segment\" : \"name of segment\"}"

Figure 2 shows an example for retrieving the details of all the components associated with a segment using cURL.

Figure 2 : Retrieving the details of all the components associated with a segment using cURL