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

# Source Code for Module Products.ZenModel.GprintGraphPoint

     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__="""GprintGraphPoint
    12
    13  Handles GraphPoints that define an rrd GPRINT
    14  """
    15
    16  from GraphPoint import GraphPoint
    17  from Globals import InitializeClass
    18
    19
    20 -def manage_addGprintGraphPoint(context, id, REQUEST = None):
    21      ''' This is here so than zope will let us copy/paste/rename
    22      graphpoints.
    23      '''
    24      gp = GprintGraphPoint(id)
    25      context._setObject(gp.id, gp)
    26      if REQUEST:
    27          return context.callZenScreen(REQUEST)
    28
    29
    30 -class GprintGraphPoint(GraphPoint):
    31
    32      meta_type = 'GprintGraphPoint'
    33
    34      vname = ''
    35      format = ''
    36      strftime = ''
    37
    38      _properties = GraphPoint._properties + (
    39          {'id':'vname', 'type':'string', 'mode':'w'},
    40          {'id':'format', 'type':'string', 'mode':'w'},
    41          {'id':'strftime', 'type':'string', 'mode':'w'},
    42          )
    43
    44
    45 -    def getDescription(self):
    46          return self.format
    47
    48
    49 -    def getType(self):
    50          return 'GPRINT'
    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          return cmds + ['GPRINT:%s:%s%s' % (
    60                      self.addPrefix(prefix, self.vname),
    61                      (self.format or self.DEFAULT_FORMAT).replace(':', '\:'),
    62                      self.strftime and ':%s' % self.strftime or '')]
    63
    64
    65  InitializeClass(GprintGraphPoint)
    66