I don't know what the root cause of this error is, but once it occurs, the
event log on the victim device never gets monitored afterwards. I made the
following changes so that the event log watcher object gets recreated for the
target device when it detects the failure, and it seems to be working.
Products/ZenWin/wmiclient.py:
Code:
105c105
< def watcher(self, wql=None):
---
> def watcher(self, wql=None, ip=None, user=None, passwd=None, sev=None):
117c117,118
< return _watcher(self._wmi.ExecNotificationQuery(wql))
---
> """ kalahari875 - 12 Nov 2007 - passing initialization info to _watcher
> """
> return _watcher(self._wmi.ExecNotificationQuery(wql), ip, user,
> passwd, sev)
123c124
< def __init__(self, event):
---
> def __init__(self, event, ip=None, user=None, passwd=None, sev=None):
125c126,132
<
---
> """ kalahari875 - 12 Nov 2007 - Added properties so watcher can produce
> values
> needed to initialize a new instance of itself when it fails
> """
> self.ip = ip
> self.user = user
> self.passwd = passwd
> self.severity = sev
Products/ZenWin/zeneventlog.py:
Code:
52c52,55
< self.devices[name] = self.getWatcher(name, ip,
user,passwd,sev)
---
> """ kalahari875 - 2007-11-12 - Moved call to another method for
> reuse
> self.devices[name] = self.getWatcher(name, ip, user,passwd,sev)
> """
> self.setWatcher(name, ip, user, passwd, sev)
65c68,85
<
---
>
> def setWatcher(self, name, ip, user, passwd, sev):
> try:
> self.devices[name] = self.getWatcher(name, ip, user, passwd, sev)
> self.log.info('created watcher for %s', name)
> except Exception, ex:
> msg = self.printComErrorMessage(ex)
> if not msg:
> msg = 'WMI connect error on %s: %s' % (name, str(ex))
> self.log.exception(msg)
> self.sendEvent(dict(summary=msg,
> device=name,
> eventClass=Status_Wmi_Conn,
> agent=self.agent,
> severity=Event.Error,
> manager=self.manager,
> component=self.name))
>
79c99
< return c.watcher(wql)
---
> return c.watcher(wql, ip, user, passwd, minSeverity)
112a133
> """ Added scode value to warning message - kalahari875 - 9
> Nov 2007
113a135,136
> """
> self.log.warn("%s %s [scode=%s]", name, msg, scode)
116a140
> """ kalahari875 - 12 Nov 2007 - Removed call to delete bad
> device, instead opting to recreate it
117a142,143
> """
> self.setWatcher(name, self.devices[name].ip,
> self.devices[name].user, self.devices[name].passwd,
> self.devices[name].severity)
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=13079#13079
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users