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