Package Products :: Package ZenHub :: Package services :: Module ThresholdMixin |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenHub.services.ThresholdMixin

     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  from Products.ZenHub.PBDaemon import translateError
    12
    13 -class ThresholdMixin:
    14      _cached_thresholdClasses = []
    15
    16      @translateError
    17 -    def remote_getThresholdClasses(self):
    18          if not self._cached_thresholdClasses:
    19              from Products.ZenModel.MinMaxThreshold import MinMaxThreshold
    20              from Products.ZenModel.ValueChangeThreshold import ValueChangeThreshold
    21              classes = [MinMaxThreshold, ValueChangeThreshold]
    22              for pack in self.dmd.ZenPackManager.packs():
    23                  classes += pack.getThresholdClasses()
    24              self._cached_thresholdClasses = map(lambda c: c.__module__, classes)
    25          return self._cached_thresholdClasses
    26
    27
    28      @translateError
    29 -    def remote_getCollectorThresholds(self):
    30          from Products.ZenModel.BuiltInDS import BuiltInDS
    31          return self.config.getThresholdInstances(BuiltInDS.sourcetype)
    32