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

# Source Code for Module Products.ZenModel.Fan

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