Adding Components in Bulk

For every administrative operation to be performed in bulk by the eG REST API, separate CSV files should be created. This implies that for adding new components to the eG Enterprise system, a dedicated CSV file is required.

To configure a CSV file with the details of the components to be added, entries of the following format should be included in that file:

Element,action
Component,add
componenttype,hostip/hostname,componentname,port,externalagents
<Details of component1>
<Details of component2>
.
.
.

For example, if you want to add 3 IIS web servers to the eG Enterprise system using the host IP, do the following:

Element,action
Component,add
componenttype,hostip,componentname,port,mtsenabled,externalagents
IIS web,192.168.10.96,iis96,80,no,ext43
IIS web,192.168.10.173,iis173,7077,no,ext173
IIS web,192.168.10.90,web90,80,no,ext85

If you want to add 3 IIS web servers to the eG Enterprise system using the host name of the component, do the following:

Element,action
Component,add
componenttype,hostname,componentname,port,mtsenabled,externalagents
IIS web,egurkha25,iis96,80,no,ext43
IIS web,egurkha26,iis173,7077,no,ext173
IIS web,egurkha27,web90,80,no,ext85

Note that the column names (componenttype, hostip, etc.) used here are the same as the input parameters of the ‘addcomponent’ command supported by eG REST API. These column names cannot be changed. Also, while providing the details of the components to be added, ensure that you follow the same order of the column names.

While adding components of different types or those which support different parameter sets, make sure that you leave the columns not applicable for a component specification, blank. At the same time, ensure that the column names you specify in the CSV file are a super-set of the parameters supported by all the components that are being added. In other words, the column names provided in the CSV file should correspond to the following:

  • the parameters that are common across all the components to be added, and;
  • the parameters that are distinct/unique for each of the components being added;

For instance, you can add an IIS web server and a Microsoft Windows component using the same CSV file, with the help of the following specification:

Element,action
Component,add
componenttype,hostip,componentname,port,mtsenabled,externalagents IIS web,192.168.10.96,iis96,80,no,ext43
Microsoft Windows,192.168.10.173, win173,,,ext180

In this case, note that the columns componenttype, hostip, componentname, and externalagents are common for both the IIS web server and the Microsoft Windows server, but the port and mtsenabled columns are supported only by the IIS web server. Moreover, since the Microsoft Windows server is a non-port-based component and does not support the mtsenabled parameter, the columns port and mtsenabled have been left blank in the specification that corresponds to the Microsoft Windows server.

If you want to say, associate multiple external agents with a component, then your specification should include a comma-separated list of external agents provided within double-quotes:

Element,action
Component,add
componenttype,hostip,componentname,port,mtsenabled,externalagents
IIS web,192.168.10.96,iis96,80,no,"ext43,ext60"
IIS web,192.168.10.173,iis173,7077,no,ext173

Similarly, you can add an Oracle database sever with multiple SIDs.

Note:

If an Oracle database server with multiple SIDs is added to the eG Enterprise system, then each SID will be registered as a separate Oracle database server in the eG Enterprise system.

Once all the required entries are defined in the CSV file (let's say, the name of the file is addcomponent.csv), execute the command specified in the URL of the table below to extract the component information from the file, connect to the required eG manager, and add the specified components to the eG Enterprise system.

Note:

A few key values of the Body parameter are optional. These optional key values are mentioned separately in the below table.

URL: http://<eG manager IP:port>/api/eg/orchestration/addcomponent/bulk

Method: POST

Content-Type: multipart/form-data

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

{

"file": G:\addcomponent.csv

}

Body

Default:

{

"file" : "Full path to the CSV file"

}

 

Success Response
Type Code Content

JSON

200

{

"Succeed": "Component has been added successfully."

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{

"Error": "Following component(s) could not be configured.",

"Description": [

"Component already exist under this type. Component type :<Component Type>,Component name :<hostname of the Component>",

]

}

Figure 1 : Example to add components in bulk using Postman REST Client

Adding Components in Bulk using cURL

To add components in bulk through the REST API using cURL, the command should be specified in the following format:

curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/addcomponent/bulk" -H "managerurl:http://<eG Manager IP:Port>" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: multipart/form-data" --form "file=@ Full path to the CSV file"

Figure 2 shows an example of adding components in bulk using cURL.

Figure 2 : Adding components in bulk using cURL