Package ZenModel :: Module LineGraphPoint
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.LineGraphPoint

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, 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 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  __doc__="""Line 
15   
16  Handles GraphPoints that define an rrd LINE 
17  """ 
18   
19  import os 
20  from GraphPoint import GraphPoint 
21  from Globals import InitializeClass 
22   
23   
24 -def manage_addLineGraphPoint(context, id, REQUEST = None):
25 ''' This is here so than zope will let us copy/paste/rename 26 graphpoints. 27 ''' 28 gp = LineGraphPoint(id) 29 context._setObject(gp.id, gp) 30 if REQUEST: 31 return context.callZenScreen(REQUEST)
32 33
34 -class LineGraphPoint(GraphPoint):
35 36 meta_type = 'LineGraphPoint' 37 38 lineWidth = 1 39 value = '' 40 color = '' 41 legend = GraphPoint.DEFAULT_LEGEND 42 stacked = False 43 44 _properties = GraphPoint._properties + ( 45 {'id':'lineWidth', 'type':'long', 'mode':'w'}, 46 {'id':'value', 'type':'string', 'mode':'w'}, 47 {'id':'color', 'type':'string', 'mode':'w'}, 48 {'id':'legend', 'type':'string', 'mode':'w'}, 49 {'id':'stacked', 'type':'boolean', 'mode':'w'}, 50 ) 51
52 - def getDescription(self):
53 return '%s %s' % (self.value, self.legend)
54 55
56 - def getType(self):
57 return 'LINE'
58 59
60 - def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx, 61 multiid=-1, prefix=''):
62 ''' Build the graphing commands for this graphpoint 63 ''' 64 value = self.addPrefix(prefix, self.value) 65 gopts = 'LINE%s:%s' % ((self.lineWidth or ''), value) 66 if self.color: 67 gopts += self.getColor(idx) 68 if self.legend or self.stacked: 69 legend = self.talesEval(self.legend, context) 70 legend = self.escapeForRRD(legend) 71 gopts += ':%s' % legend 72 if self.stacked: 73 gopts += ':STACK' 74 return cmds + [gopts]
75 76 77 InitializeClass(LineGraphPoint) 78