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