Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
neochaser5
Explorer

How do I add hundreds of existing IP hosts and ranges in a group object

I have been tasked to add a list of IP address hosts and ranges and its almost close to 300. These IPs already exists in the object explorer so I guess the approach i need is to find out the names of these objects, then used the command below to add them in a group?

 

set group name "my_group" members.add.1 "host1" members.add.2 "host2" members.add.3 "host3"

 

Appreciate also if you would have a better way of doing it. Thank you in advance. 

0 Kudos
2 Replies
Maik
Advisor

If you do not only have the IP address of these objects but also the names (assuming they are unique) you could go via the following approach:

Create a file called "hosts.csv" or however you want to call it.
Write the following information in the first line:
name, groups.add
Add the Information of the related hosts from the second line until you are done, e.g.:
host1, groupABC
host2, groupABC
(…)

Do the same for the address ranges (exact same format), but save it under a different name, e.g. "ranges.csv".

Execute the following commands (make sure to be in the same directory where the csv files are placed, otherwise specify the path to the file | the example is for local execution on the Management server, when doing it remote from a Windows host via mgmt_cli.exe you need to add the -m Option followed by the management server IP address):

"mgmt_cli set host -b ./hosts.csv"
"mgmt_cli set address-range -b ./ranges.csv"

If you do not have a list for the object names you Need to call the api in order to find the names for a given IP and afterwards do the just described Tasks. How you can find the Name of an object by just having it's IP? => use the "show objects filter 'w.x.y.z'" API call/command. In this case you Need to make sure that you retreice the correct objects because this call will return all objects that have the given IP of "w.x.y.z." assigned to it. (not a Problem the IPs in your management server are unique related to objects)

0 Kudos
tienne
Explorer

how can i delete the ./hosts.csv?

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events