- CheckMates
- :
- Products
- :
- Quantum
- :
- Management
- :
- Re: Format of csv file to add object in group
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Format of csv file to add object in group
Hi,
I am trying to add the objects to the specific group using .csv file. I found " mgmt_cli set group --batch group-members_full_csv.csv
" command from one of the SK but couldn't find the csv format. Has anybody done this, if yes please give me the format of .csv file.
Regards,
Sagar Manandhar
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The full command for set group can be found at the following URL:
https://sc1.checkpoint.com/documents/latest/APIs/index.html#gui-cli/set-group~v1.1
The CSV should have the following header row:
name,members.add
The name field is for the group and the members.add field will be the host object to add to the group.
The rest of the body of the CSV would then be filled in as you wish:
group1,host1
group1,host2
group1,host3
group2,host1
group2,host2
group2,host3
You can then use the mgmt_cli command to run the batch job:
mgmt_cli -r true login > session.id
mgmt_cli -s session.id set group -b CSVFILE
mgmt_cli -s session.id publish
mgmt_cli -s session.id logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The full command for set group can be found at the following URL:
https://sc1.checkpoint.com/documents/latest/APIs/index.html#gui-cli/set-group~v1.1
The CSV should have the following header row:
name,members.add
The name field is for the group and the members.add field will be the host object to add to the group.
The rest of the body of the CSV would then be filled in as you wish:
group1,host1
group1,host2
group1,host3
group2,host1
group2,host2
group2,host3
You can then use the mgmt_cli command to run the batch job:
mgmt_cli -r true login > session.id
mgmt_cli -s session.id set group -b CSVFILE
mgmt_cli -s session.id publish
mgmt_cli -s session.id logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kudos for "members.add", not intuitive at all.
Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have run the batch file but getting below error.
csv format is like below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
does the file exist in your current workin directory?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Robert,
Ok. I have put my file in existing directory and it worked. I adjusted the setting of format and it worked.
Thanks for your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think issue is because of _(underscore), use -(dash) instead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi masher,
Thanks, it really worked for me. It helped me to Block almost 120 IP addresses at once using this method. The detailed procedure of my task is mentioned below. Hope it can help others too.
Step 1 : Make the CSV file of object name and IP address in following format (filename =script1.csv)
name,ip-address
name1,xxx.xxx.xxx.xx
name1,xxx.xxx.xxx.xx
name1,xxx.xxx.xxx.xx
Login to the device through CLI
change the location to tmp ( cd /tmp )
create a script file inside it ( vi Script1.csv )
paste the CSV file
to check whether the file is created or not paste (cat script.csv)
Run CSV file (mgmt_cli add host --batch script1.csv)
provide username and password
Step 2 : Make CSV file of Object group name and object name (filename = script2.csv)
name,members.add
groupname, name2
groupname, name2
groupname, name2
Login to device through CLI
change the location ot tmp ( cd /tmp )
create a script file inside it ( vi Script2.csv )
paste the csv file
to check weather the file is created of not paste (cat scrip2.csv)
mgmt_cli -r true login > session.id
mgmt_cli -s session.id set group -b script2.csv
mgmt_cli -s session.id publish
mgmt_cli -s session.id logout
If the locked session error is seen then try to publish and install the previous policies and logout/disconnect or takeover all the Read and write sessions and ten try Step 2
Refrences
https://www.youtube.com/watch?v=li4vRH63-_8
https://community.checkpoint.com/t5/Management/Format-of-csv-file-to-add-object-in-group/td-p/8987
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
csv file would look like below.
