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

# Source Code for Module Products.ZenModel.ShiftGraphPoint

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