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

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

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