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

# Source Code for Module Products.ZenModel.Fan

     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__="""Fan
    12
    13  Fan is an abstraction of any fan on a device. CPU, chassis, etc.
    14
    15  $Id: Fan.py,v 1.7 2004/04/06 22:33:24 edahl Exp $"""
    16
    17  __version__ = "$Revision: 1.7 $"[11:-2]
    18
    19  from Globals import InitializeClass
    20
    21  from Products.ZenRelations.RelSchema import *
    22
    23  from HWComponent import HWComponent
    24
    25  from Products.ZenModel.ZenossSecurity import *
    26
    27 -class Fan(HWComponent):
    28      """Fan object"""
    29
    30      portal_type = meta_type = 'Fan'
    31
    32      state = "unknown"
    33      type = "unknown"
    34
    35      _properties = HWComponent._properties + (
    36          {'id':'state', 'type':'string', 'mode':'w'},
    37          {'id':'type', 'type':'string', 'mode':'w'},
    38      )
    39
    40      _relations = HWComponent._relations + (
    41          ("hw", ToOne(ToManyCont, "Products.ZenModel.DeviceHW", "fans")),
    42          )
    43
    44
    45      factory_type_information = (
    46          {
    47              'id'             : 'Fan',
    48              'meta_type'      : 'Fan',
    49              'description'    : """Arbitrary device grouping class""",
    50              'icon'           : 'Fan_icon.gif',
    51              'product'        : 'ZenModel',
    52              'factory'        : 'manage_addFan',
    53              'immediate_view' : 'viewFan',
    54              'actions'        :
    55              (
    56                  { 'id'            : 'status'
    57                  , 'name'          : 'Status'
    58                  , 'action'        : 'viewFan'
    59                  , 'permissions'   : ('View',)
    60                  },
    61                  { 'id'            : 'perfConf'
    62                  , 'name'          : 'Template'
    63                  , 'action'        : 'objTemplates'
    64                  , 'permissions'   : ("Change Device", )
    65                  },
    66              )
    67            },
    68          )
    69
    70
    71 -    def rpmString(self):
    72          """
    73          Return a string representation of the RPM
    74          """
    75          rpm = self.rpm()
    76          return rpm is None and "unknown" or "%lrpm" % (rpm,)
    77
    78
    79 -    def rpm(self, default=None):
    80          """
    81          Return the current RPM
    82          """
    83          rpm = self.cacheRRDValue('rpm', default)
    84          if rpm is not None:
    85              return long(rpm)
    86          return None
    87
    88
    89 -    def viewName(self):
    90          return self.id
    91      name = viewName
    92
    93
    94  InitializeClass(Fan)
    95