Trees | Indices | Help |
|
---|
|
1 ############################################################################## 2 # 3 # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 4 # 5 # This content is made available according to terms specified in 6 # License.zenoss under the directory where your Zenoss product is installed. 7 # 8 ############################################################################## 9 10 11 from Products.ZenUtils import Time 1214 zem = dmd.ZenEventManager 15 startDate = args.get('startDate', zem.defaultAvailabilityStart()) 16 endDate = args.get('endDate', zem.defaultAvailabilityEnd()) 17 startDate, endDate = map(Time.ParseUSDate, (startDate, endDate)) 18 endDate = Time.getEndOfDay(endDate) 19 startDate = min(startDate, endDate - 24 * 60 * 60 + 1) # endDate - 23:59:59 20 how = args.get('how', 'AVERAGE') 21 return dict(start=startDate, end=endDate, function=how)2224 swapper = { 'MAXIMUM':'MINIMUM', 'MINIMUM':'MAXIMUM'} 25 summary = summary.copy() 26 current = summary['function'] 27 summary['function'] = swapper.get(current, current) 28 return summary29 3032 import re 33 34 deviceFilter = args.get('deviceFilter', '') or '' 35 deviceMatch = re.compile('.*%s.*' % deviceFilter) 36 37 # Fall back for backwards compatibility 38 if 'deviceClass' in args: 39 # deviceClass should always start with a '/' 40 args['organizer'] = '/Devices' + args['deviceClass'] 41 42 # Get organizer 43 organizer = args.get('organizer', '/Devices') or '/Devices' 44 45 # Determine the root organizer 46 try: 47 root = dmd.getObjByPath(organizer.lstrip('/')) 48 except KeyError: 49 root = dmd.Devices # Show all if org not found 50 51 # Iterate all sub-organizers and devices 52 for d in root.getSubDevices(): 53 if not d.monitorDevice(): continue 54 if not deviceMatch.match(d.id): continue 55 yield d56
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1.1812 on Mon Jul 30 17:11:41 2012 | http://epydoc.sourceforge.net |