Hi all,

At last come up with a code to mass resetting DNS for all Devices that I intend 
to work with. Truly noob in Python, glad to share this one out to all who want 
to use it. In my case, the Devices that I want to work with is in the Systems, 
perhaps others can use Devices etc to get to their devices that they want to 
work with..


Code:
 
#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit

dmd = ZenScriptBase(connect=True).dmd

for d in dmd.Systems.getSubDevices():
    evids = [ e.evid for e in dmd.ZenEventManager.getEventListME(d) ]

    if (len(evids) !=0):
        d.setManageIp()
        commit()

        dmd.ZenEventManager.manage_ackEvents(evids)
        dmd.ZenEventManager.manage_deleteEvents(evids)
        commit()

        dmd.ZenEventManager.manage_clearHeartbeats()
        commit()

        d.checkRelations(repair=True)
        commit()

        d.pushConfig()
        commit()

        d.collectDevice()
        commit()







-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=26881#26881

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to