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

Source Code for Module ZenModel.CdefGraphPoint

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