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

Source Code for Module ZenModel.TickGraphPoint

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