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

Source Code for Module Products.ZenModel.PingDataSource

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2010, 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  __doc__ = """PingDataSource.py 
12   
13  Defines datasource for zenping 
14  """ 
15   
16  from Globals import InitializeClass 
17  from AccessControl import ClassSecurityInfo, Permissions 
18  import Products.ZenModel.RRDDataSource as RRDDataSource 
19   
20  PING_DATAPOINTS = ( 
21      'rtt_avg', 
22      'rtt_min', 
23      'rtt_max', 
24      'rtt_losspct', 
25      'rtt_stddev', 
26  ) 
27   
28 -class PingDataSource(RRDDataSource.RRDDataSource):
29 30 PING = 'PING' 31 32 sourcetypes = (PING,) 33 sourcetype = PING 34 35 timeout = 2 36 eventClass = '/Status/Ping' 37 38 cycleTime = 60 39 sampleSize = 1 40 attempts = 2 41 42 _properties = RRDDataSource.RRDDataSource._properties + ( 43 {'id':'cycleTime', 'type':'int', 'mode':'w'}, 44 {'id':'sampleSize', 'type':'int', 'mode':'w'}, 45 {'id':'attempts', 'type':'int', 'mode':'w'}, 46 ) 47 48 security = ClassSecurityInfo() 49
50 - def __init__(self, id, title=None, buildRelations=True):
52
53 - def getDescription(self):
54 if self.sourcetype == self.PING: 55 return "Ping " 56 return RRDDataSource.RRDDataSource.getDescription(self)
57
58 - def useZenCommand(self):
59 return False
60
61 - def addDataPoints(self):
62 for dp in PING_DATAPOINTS: 63 if self.datapoints._getOb(dp, None) is None: 64 self.manage_addRRDDataPoint(dp)
65
66 - def zmanage_editProperties(self, REQUEST=None):
67 '''validation, etc''' 68 if REQUEST: 69 # ensure default datapoint didn't go away 70 self.addDataPoints() 71 # and eventClass 72 if not REQUEST.form.get('eventClass', None): 73 REQUEST.form['eventClass'] = self.__class__.eventClass 74 return RRDDataSource.RRDDataSource.zmanage_editProperties(self, REQUEST)
75 76 InitializeClass(PingDataSource) 77