On 5/16/07, rushjk <[EMAIL PROTECTED]> wrote:
I've been trying to update a large number of devices that were not placed in a
system when they were added. This is some test code I've come up with, and I
can tell that it probably won't work due to the braces or backslash passed as
systemPaths. Is there another way to do this? Any help would be appreciated,
especially since I don't want to edit over 200 entries manually. I'm not sure
if I'm even on the right track with this script. Thanks in advance.
Jamey,
Since you're already using Python anyway, I'd suggest doing this in
zendmd. It'll be a lot cleaner than the REST interface. Run "zendmd"
as the zenoss user to be put into the Zenoss shell. Then you can do
something like this:
# Set system based on a list of device names.
devices = "store101,store102,store103,store104".split(',')
for name in devices:
dev = find(name)
if dev != None:
dev.addSystem("/YourSystemName")
# Alternatively set the system by string matching on all device names.
for dev in dmd.Devices.getSubDevices():
if dev.id.startswith('store'):
dev.addSystem("/YourSystemName")
Hope this helps.
--
Chet Luther
[EMAIL PROTECTED]
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users