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

# Source Code for Module Products.ZenModel.CdefGraphPoint

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__="""CdefGraphPoint
    12
    13  Handles GraphPoints that define an rrd CDEF
    14  """
    15
    16  from Globals import InitializeClass
    17
    18  from Products.ZenModel.RpnGraphPoint import RpnGraphPoint
    19
    20
    21 -def manage_addCdefGraphPoint(context, id, REQUEST = None):
    22      ''' This is here so than zope will let us copy/paste/rename
    23      graphpoints.
    24      '''
    25      gp = CdefGraphPoint(id)
    26      context._setObject(gp.id, gp)
    27      if REQUEST:
    28          return context.callZenScreen(REQUEST)
    29
    30
    31 -class CdefGraphPoint(RpnGraphPoint):
    32      meta_type = 'CdefGraphPoint'
    33
    34
    35 -    def getType(self):
    36          return 'CDEF'
    37
    38
    39 -    def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx,
    40                          multiid=-1, prefix=''):
    41          ''' Build the graphing commands for this graphpoint
    42          '''
    43          from Products.ZenUtils.Utils import unused
    44          unused(rrdDir)
    45          if not self.rpn:
    46              return cmds
    47          rpn = self.talesEval(self.rpn, context)
    48          return cmds + ['CDEF:%s=%s' % (
    49                          self.getDsName(self.id, multiid, prefix),
    50                          self.getRpn(multiid, prefix))]
    51
    52
    53  InitializeClass(CdefGraphPoint)
    54