Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
BeaconBits
Contributor

Best way to add Object host name in the Group??

Hi Everyone,

I've been tasked to add over 100+ object host names in the group.

Now some of the object names (host) does exist but through scripting how is it possible that if a written script does not create one that already in the Object database.

I have looked few options, through Management CLI is easy...

1 - # add host name myHost ip-address 192.168.0.100

or 

2 - # add group name myGroup members.1 myHost1 members.2 myHost2

Through number 2 statement above, can I create a script where it does not create where it exists already?

I have tried also that, if I break second line command in 10 members host and run it then "add group" does give an error that this group name exists already.

REST api could be an option but through cli with for loop or if conditions .. is there anything available?

Regards,

B

3 Replies
Robert_Decker
Advisor

In the case of "add host" command, you can use the "set-if-exists" parameter with value "true" and it will override an existing host with the new values.

In the case of "add group" command, there is no such parameter. You can call the "show group" command and check if the return value is 1 - group doesn't exist.

Robert.

BeaconBits
Contributor

Thanks Rob,

Is there a way that we can add host object in the existing group?

0 Kudos
Robert_Decker
Advisor

Of course, there is a "set-group" command to update an existing group object - 

https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/set-group~v1.2%20

For example- 

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

Robert.

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events