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 # This program is part of Zenoss Core, an open source monitoring platform. 12 # This program is free software; you can redistribute it and/or modify it 13 # under the terms of the GNU General Public License version 2 or (at your 14 # option) any later version as published by the Free Software Foundation. 15 # For complete information please visit: http://www.zenoss.com/oss/ 16 from Products.Zuul import getFacade 17 from time import time 1820 if deviceRoot is None: 21 return deviceName 22 device = deviceRoot.findDevice(deviceName) 23 if device is None: 24 return deviceName 25 return "<a href='%s'>%s</a>" % (device.getPrimaryUrlPath(), 26 device.titleOrId())2728 -def getHeartbeatObjects(failures=True, limit=0, deviceRoot=None, 29 keys=('alink', 'comp', 'dtime', 'devId')):30 beats = [] 31 now = int(time() * 1000) 32 heartbeats = getFacade('zep').getHeartbeats() 33 for heartbeat_dict in heartbeats: 34 # Seconds is difference between current time and last reported time 35 # ZEP returns milliseconds, so perform appropriate conversion 36 seconds = (now - heartbeat_dict['last_time']) / 1000 37 if failures is False or seconds >= heartbeat_dict['timeout_seconds']: 38 beat = { 39 keys[0]: deviceLink(deviceRoot, heartbeat_dict['monitor']), 40 keys[1]: heartbeat_dict['daemon'], 41 keys[2]: seconds 42 } 43 if len(keys) > 3: 44 beat[keys[3]] = heartbeat_dict['monitor'] 45 beats.append(beat) 46 if limit: 47 return beats[:limit] 48 return beats49
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1.1812 on Mon Jul 30 17:11:45 2012 | http://epydoc.sourceforge.net |