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

Source Code for Module Products.ZenModel.ShiftGraphPoint

 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  __doc__="""ShiftGraphPoint 
12   
13  Handles GraphPoints that define an rrd SHIFT 
14  """ 
15   
16  from GraphPoint import GraphPoint 
17  from Globals import InitializeClass 
18  from Products.ZenUtils.deprecated import deprecated 
19 20 21 @deprecated 22 -def manage_addShiftGraphPoint(context, id, REQUEST = None):
23 ''' This is here so than zope will let us copy/paste/rename 24 graphpoints. 25 ''' 26 gp = ShiftGraphPoint(id) 27 context._setObject(gp.id, gp) 28 if REQUEST: 29 return context.callZenScreen(REQUEST)
30
31 32 -class ShiftGraphPoint(GraphPoint):
33 34 meta_type = 'ShiftGraphPoint' 35 rrdFile = None 36 vname = '' 37 offset = 0 38 39 _properties = GraphPoint._properties + ( 40 {'id':'vname', 'type':'string', 'mode':'w'}, 41 {'id':'offset', 'type':'long', 'mode':'w'}, 42 ) 43
44 - def getDescription(self):
45 return '%s' % self.offset
46 47
48 - def getType(self):
49 return 'SHIFT'
50 51
52 - def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx, 53 multiid=-1, prefix=''):
54 ''' Build the graphing commands for this graphpoint 55 ''' 56 from Products.ZenUtils.Utils import unused 57 unused(multiid, rrdDir) 58 if not (self.rrdFile and self.dsName and self.cFunc): 59 return cmds 60 61 offset = self.talesEval(self.offset, context) 62 63 return cmds + ['SHIFT:%s:%s' % ( 64 self.addPrefix(prefix, self.vname), offset or 0)]
65 66 67 InitializeClass(ShiftGraphPoint) 68