Create new Zone using nxshell

Started by suphu, October 01, 2020, 06:15:48 PM

Previous topic - Next topic

suphu

Hi,

Is it possible to create a new zone using nxshell in version 3.5?

Thanks.

Filipp Sudanov

nxshell allows to do anything the management console can do.

Zone creation should be similar to node creation (see examples here: https://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations#Create_Container_and_some_nodes)
you just need to specify another object class

suphu

Thanks.  I will give that a try and post my code snippet when I get it working.

suphu

Yep - worked like a charm!

parentId = objects.GenericObject.NETWORK # Entire Network root
cd = NXCObjectCreationData(objects.GenericObject.OBJECT_ZONE, "Sample Zone", parentId);
zoneId = session.createObject(cd) # createObject return ID of newly created object
print '"Sample Zone" created, id=%d' % (zoneId, )