TECHZEN Zenoss User Community ARCHIVE  

script delete locations

Subject: script delete locations
Author: [Not Specified]
Posted: 2014-05-07 17:22

hi guys, i ran a script through zendmd to delete all locations, about 500.
somehow the locations root organizer name is blank now.
anyone knows how to restore it

>>> for loc in dmd.Locations:
... dmd.Locations.manage_deleteOrganizer(loc)
...
>>> commit()

screen capture
http://s27.postimg.org/tgidmytkj/image001.png



Subject: Bad News
Author: Andrew Kirch
Posted: 2014-05-08 12:44

dmd.Locations stores the locations of quite a few things, and not just the hierarchy. You've actually done quite a bit of damage to your Zenoss instance. I'd recommend doing a
>>> for loc in dmd.Locations:
... print loc;
...
on a fresh install, and attempt to repair.

Andrew Kirch

akirch@gvit.com

Need Zenoss support, consulting or custom development Look no further. Email or PM me!

Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard



Subject: i did a zenrestore to repair
Author: [Not Specified]
Posted: 2014-05-12 07:56

i did a zenrestore to repair the instance.
Ran a script i found here but now with the locations i wanted to delete.
Thanks for the reply!

-------------------------------------------------------------------------------------------------
print dmd.Locations.getOrganizerNames()

loc_names_to_delete = ('location1', 'location2')

for loc in dmd.Locations:
if loc in loc_names_to_delete:
dmd.Locations.manage_deleteOrganizer(loc)

commit()

-------------------------------------------------------------------------------------------------



< Previous
'ZODB.POSException.POSKeyError'
  Next
Using WinPerf data source to monitor disk IO in Zenoss 4.2.4
>