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

# Source Code for Module Products.ZenModel.RpnGraphPoint

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2011, 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__="""RpnGraphPoint
    15
    16  Base class for graph points with RPNs. Never directly instantiated.
    17  """
    18
    19  from Globals import InitializeClass
    20
    21  from Products.ZenModel.GraphPoint import GraphPoint
    22  from Products.ZenRRD.utils import rpnStack
    23
    24
    25 -class RpnGraphPoint(GraphPoint):
    26      rpn = ''
    27
    28      _properties = GraphPoint._properties + (
    29          {'id':'rpn', 'type':'string', 'mode':'w'},
    30          )
    31
    32 -    def getDescription(self):
    33          return self.rpn
    34
    35
    36 -    def getRpn(self, multiid=-1, prefix=''):
    37          parts = self.rpn.split(',')
    38          for i, var in enumerate(parts):
    39              try:
    40                  unused = float(var)
    41                  continue
    42              except ValueError:
    43                  pass
    44
    45              if var in rpnStack.opcodes:
    46                  continue
    47
    48              parts[i] = self.getDsName(var, multiid, prefix)
    49
    50          return ','.join(parts)
    51
    52
    53  InitializeClass(RpnGraphPoint)
    54