Package Products :: Package ZenModel :: Module PingDataSource
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.PingDataSource

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2010, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  __doc__ = """PingDataSource.py 
15   
16  Defines datasource for zenping 
17  """ 
18   
19  from Globals import InitializeClass 
20  from AccessControl import ClassSecurityInfo, Permissions 
21  import Products.ZenModel.RRDDataSource as RRDDataSource 
22   
23   
24 -class PingDataSource(RRDDataSource.RRDDataSource):
25 26 PING = 'PING' 27 28 sourcetypes = (PING,) 29 sourcetype = PING 30 31 timeout = 2 32 eventClass = '/Status/Ping' 33 34 cycleTime = 60 35 sampleSize = 1 36 attempts = 2 37 38 _properties = RRDDataSource.RRDDataSource._properties + ( 39 {'id':'cycleTime', 'type':'int', 'mode':'w'}, 40 {'id':'sampleSize', 'type':'int', 'mode':'w'}, 41 {'id':'attempts', 'type':'int', 'mode':'w'}, 42 ) 43 44 security = ClassSecurityInfo() 45
46 - def __init__(self, id, title=None, buildRelations=True):
48
49 - def getDescription(self):
50 if self.sourcetype == self.PING: 51 return "Ping " 52 return RRDDataSource.RRDDataSource.getDescription(self)
53
54 - def useZenCommand(self):
55 return False
56
57 - def addDataPoints(self):
58 if not self.datapoints._getOb('rtt', None): 59 self.manage_addRRDDataPoint('rtt')
60
61 - def zmanage_editProperties(self, REQUEST=None):
62 '''validation, etc''' 63 if REQUEST: 64 # ensure default datapoint didn't go away 65 self.addDataPoints() 66 # and eventClass 67 if not REQUEST.form.get('eventClass', None): 68 REQUEST.form['eventClass'] = self.__class__.eventClass 69 return RRDDataSource.RRDDataSource.zmanage_editProperties(self, REQUEST)
70 71 InitializeClass(PingDataSource) 72