ZENDMD Tip - Delete Networks

From Zenoss Wiki
Revision as of 18:59, 7 August 2013 by Jcurry (Talk | contribs)$7

Jump to: navigation, search

If you delete lots of devices, the networks discovered that were associated with them never get cleaned up. There's no way in the GUI to select lots of networks and delete them - you can only do them individually.

I wanted to delete all networks except This script deletes ALL IP V4 networks except

Create delete_networks with:

#!/usr/bin/env zendmd
for netid in dmd.Networks.objectIds(spec="IpNetwork"):
        print "Deleting network %s" % netid
        if netid == '':
            print 'Dont delete %s' % (netid)
    except Exception, e:
        print "%s: %s" % (netid, str(e))

To test, comment out the dmd.Networks._delObject(netid) line.

Make it executable and run it as the zenoss user.

JaneCurry (talk) 18:57, 7 August 2013 (UTC)