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

# Source Code for Module Products.ZenModel.PrintGraphPoint

     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 or (at your
     8  # option) any later version as published by the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  __doc__="""PrintGraphPoint
    15
    16  Handles GraphPoints that define an rrd PRINT
    17  """
    18
    19  from GraphPoint import GraphPoint
    20  from Globals import InitializeClass
    21
    22
    23 -def manage_addPrintGraphPoint(context, id, REQUEST = None):
    24      ''' This is here so than zope will let us copy/paste/rename
    25      graphpoints.
    26      '''
    27      gp = PrintGraphPoint(id)
    28      context._setObject(gp.id, gp)
    29      if REQUEST:
    30          return context.callZenScreen(REQUEST)
    31
    32
    33 -class PrintGraphPoint(GraphPoint):
    34
    35      meta_type = 'PrintGraphPoint'
    36
    37      vname = ''
    38      format = ''
    39      strftime = ''
    40
    41      _properties = GraphPoint._properties + (
    42          {'id':'vname', 'type':'string', 'mode':'w'},
    43          {'id':'format', 'type':'string', 'mode':'w'},
    44          {'id':'strftime', 'type':'string', 'mode':'w'},
    45          )
    46
    47 -    def getDescription(self):
    48          return self.format
    49
    50
    51 -    def getType(self):
    52          return 'PRINT'
    53
    54
    55 -    def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx,
    56                          multiid=-1, prefix=''):
    57          ''' Build the graphing commands for this graphpoint
    58          '''
    59          from Products.ZenUtils.Utils import unused
    60          unused(multiid, rrdDir)
    61          return cmds + ['PRINT:%s:%s%s' % (
    62                      self.addPrefix(prefix, self.vname),
    63                      (self.format or self.DEFAULT_FORMAT).replace(':', '\:'),
    64                      self.strftime and ':%s' % self.strftime or '')]
    65
    66
    67  InitializeClass(PrintGraphPoint)
    68