Skip to content

Commit

Permalink
Fix "no data returned for command" events.
Browse files Browse the repository at this point in the history
  • Loading branch information
cluther committed Aug 28, 2012
1 parent e273b64 commit 74f3cec
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
15 changes: 13 additions & 2 deletions ZenPacks/zenoss/oVirt/poll_ovirt.py
Expand Up @@ -913,5 +913,16 @@ def run(self):
events = True

#time.sleep(random.randint(1, 5))
poller = oVirtPoller(url, username, domain, password, collect_events=events)
poller.run()
try:
poller = oVirtPoller(url, username, domain, password, collect_events=events)
poller.run()
except Exception, e:
print json.dumps({
'events': [{
'severity': 4,
'summary': 'oVirt error: %s' % e,
'eventKey': 'ovirt_failure',
'eventClassKey': 'ovirt_error',
}],
'values': {},
}, sort_keys=True, indent=4)
25 changes: 18 additions & 7 deletions ZenPacks/zenoss/oVirt/poll_ovirtcounts.py
Expand Up @@ -96,12 +96,12 @@ def _saved(self, key):
return None

# Make sure temporary data isn't too stale.
if os.stat(tmpfile).st_mtime < (time.time() - 50):
try:
try:
if os.stat(tmpfile).st_mtime < (time.time() - 50):
os.unlink(tmpfile)
except Exception:
pass
return None
return None
except Exception:
pass

try:
tmp = open(tmpfile, 'r')
Expand Down Expand Up @@ -252,5 +252,16 @@ def run(self):
sys.exit(1)

#time.sleep(random.randint(1, 5))
counter = oVirtCounter(url, username, domain, password, ovirt_id)
counter.run()
try:
counter = oVirtCounter(url, username, domain, password, ovirt_id)
counter.run()
except Exception, e:
print json.dumps({
'events': [{
'severity': 4,
'summary': 'oVirt error: %s' % e,
'eventKey': 'ovirt_failure',
'eventClassKey': 'ovirt_error',
}],
'values': {},
}, sort_keys=True, indent=4)

0 comments on commit 74f3cec

Please sign in to comment.