Discussion:
How to reset IP using zendmd?
kiiwii
2012-08-23 17:10:17 UTC
Permalink
kiiwii [http://community.zenoss.org/people/kiiwii] created the discussion

"Re: mass-DNS-resetter.py"

To view the discussion, visit: http://community.zenoss.org/message/68115#68115

--------------------------------------------------------------
great !!! men!

Consider the former ip may not that quitely be assigned to some other machine that allows ping.
(even worse like that, some specific http service should come into consideration.)
and since the event related to dynamic ip change should have the eventclass of "/Status/Ping".
I made some modification base on your script, as follow, which I think makes more sense:



#!/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.Devices.getSubDevices():
## if you have them grouped
#for d in getattr(dmd.Groups, 'Group name').getSubDevices():
    for e in dmd.ZenEventManager.getEventListME(d):
        if e.eventClass == "/Status/Ping":
            d.setManageIp()
            commit()


            dmd.ZenEventManager.manage_ackEvents(e.evid)
            dmd.ZenEventManager.manage_deleteEvents(e.evid)
            commit()


            dmd.ZenEventManager.manage_clearHeartbeats()
            commit()


            d.checkRelations(repair=True)
            commit()


            d.pushConfig()
            commit()


            d.collectDevice()
            commit()
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/68115#68115]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...