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

Source Code for Module 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 as published by 
  8  # 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 { 'id' : 'viewHistory' 70 , 'name' : 'Modifications' 71 , 'action' : 'viewHistory' 72 , 'permissions' : (ZEN_VIEW_MODIFICATIONS,) 73 }, 74 ) 75 }, 76 ) 77 78
79 - def rpmString(self):
80 """ 81 Return a string representation of the RPM 82 """ 83 rpm = self.rpm() 84 return rpm is None and "unknown" or "%lrpm" % (rpm,)
85 86
87 - def rpm(self, default=None):
88 """ 89 Return the current RPM 90 """ 91 rpm = self.cacheRRDValue('rpm', default) 92 if rpm is not None: 93 return long(rpm) 94 return None
95 96
97 - def viewName(self):
98 return self.id
99 name = viewName
100 101 102 InitializeClass(Fan) 103