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

Source Code for Module Products.ZenModel.HruleGraphPoint

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