Adding Remote Agents in Bulk

The CSV file created specifically for adding multiple remote agents to the eG Enterprise system, should contain the following entries:

Element,action
RemoteAgent,add
hostip,agentname
<Details of remoteagent1>
<Details of remoteagent2>
<Details of remoteagent3>
.
.
.

For instance:

Element,action
RemoteAgent,add
hostip,agentname
192.168.10.8,rem8
192.168.10.10,rem10
192.168.10.12,lin12

Note that the column names used in the CSV file are the same as the input parameters of the ‘addremoteagent’ command supported by the eG REST API.

Once the CSV file (let's say, the name of the file is addremagent.csv) is created on the eG manager, invoke the URL command mentioned in the below table from the eG REST API Client to update the eG manager with all the modifications contained in the CSV file.

URL: http://<eG manager IP:port>/api/eg/orchestration/addremoteagent/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:\addremagent.csv

}

Body

Default:

{

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

}

 

Success Response
Type Code Content

JSON

200

{

"Succeed": "Remote agent has been added successfully."

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{

"Error": "Following remote agent(s) could not be added.",

"Description": [

"The agent name you are trying to add already exists. Please use another agent name. Agent name :<name of the remote agent>",

"The agent name you are trying to add already exists. Please use another agent name. Agent name :<name of the remote agent>"

]

}

Figure 1 : Example to add remote agents in bulk

Adding Remote Agents in Bulk using cURL

To add remote agents 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/addremoteagent/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 remote agents in bulk using cURL.

Figure 2 : Adding remote agents in bulk using cURL