Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 22a7b2b
Showing
38 changed files
with
2,871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
All files in this directory and below are: | ||
|
||
Copyright (c) 2009 Zenoss, Inc. All rights reserved. | ||
|
||
This program is free software; you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License version 2 as published | ||
by the Free Software Foundation. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
graft ZenPacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
################################################################################ | ||
# | ||
# This program is part of the deviceAdvDetail Zenpack for Zenoss. | ||
# Copyright (C) 2009, 2010 Egor Puzanov. | ||
# | ||
# This program can be used under the GNU General Public License version 2 | ||
# You can find full information here: http://www.zenoss.com/oss | ||
# | ||
################################################################################ | ||
|
||
__doc__="""HWStatus | ||
HWStatus is an abstraction of Hardware status indication. | ||
$Id: HWStatus.py,v 1.4 2010/06/29 23:49:41 egor Exp $""" | ||
|
||
__version__ = "$Revision: 1.4 $"[11:-2] | ||
|
||
DOT_GREEN = 'green' | ||
DOT_PURPLE = 'purple' | ||
DOT_BLUE = 'blue' | ||
DOT_YELLOW = 'yellow' | ||
DOT_ORANGE = 'orange' | ||
DOT_RED = 'red' | ||
DOT_GREY = 'grey' | ||
|
||
SEV_CLEAN = 0 | ||
SEV_DEBUG = 1 | ||
SEV_INFO = 2 | ||
SEV_WARNING = 3 | ||
SEV_ERROR = 4 | ||
SEV_CRITICAL = 5 | ||
|
||
|
||
class HWStatus: | ||
"""HW Status object""" | ||
|
||
status = 1 | ||
|
||
statusmap ={1: (DOT_GREY, SEV_WARNING, 'other'), | ||
2: (DOT_GREEN, SEV_CLEAN, 'Ok'), | ||
3: (DOT_ORANGE, SEV_ERROR, 'Degraded'), | ||
4: (DOT_RED, SEV_CRITICAL, 'Failed'), | ||
} | ||
|
||
def statusDot(self, status=None): | ||
""" | ||
Return the Dot Color based on maximal severity | ||
""" | ||
if status is None: | ||
colors = [ DOT_GREY, DOT_GREEN, DOT_PURPLE, DOT_BLUE, DOT_YELLOW, | ||
DOT_ORANGE, DOT_RED] | ||
if not self.monitor: return DOT_GREY | ||
status = self.status | ||
severity = colors.index(self.statusmap[status][0]) | ||
eseverity = self.ZenEventManager.getMaxSeverity(self) + 1 | ||
if severity == 0 and eseverity == 1: return DOT_GREY | ||
if eseverity > severity: | ||
severity = eseverity | ||
return colors[severity] | ||
return self.statusmap.get(status, (DOT_GREY, SEV_WARNING, 'other'))[0] | ||
|
||
def statusSeverity(self, status=None): | ||
""" | ||
Return the severity based on status | ||
0:'Clean', 1:'Debug', 2:'Info', 3:'Warning', 4:'Error', 5:'Critical' | ||
""" | ||
if status is None: status = self.status | ||
return self.statusmap.get(status, (DOT_GREY, SEV_WARNING, 'other'))[1] | ||
|
||
def statusString(self, status=None): | ||
""" | ||
Return the status string | ||
""" | ||
if status is None: status = self.status | ||
return self.statusmap.get(status, (DOT_GREY, SEV_WARNING, 'other'))[2] | ||
|
||
|
||
def getStatus(self): | ||
""" | ||
Return the status | ||
""" | ||
return self.statusSeverity() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
################################################################################ | ||
# | ||
# This program is part of the deviceAdvDetail Zenpack for Zenoss. | ||
# Copyright (C) 2008, 2009, 2010 Egor Puzanov. | ||
# | ||
# This program can be used under the GNU General Public License version 2 | ||
# You can find full information here: http://www.zenoss.com/oss | ||
# | ||
################################################################################ | ||
|
||
__doc__="""LogicalDisk | ||
LogicalDisk is an abstraction of a logicaldisk. | ||
$Id: LogicalDisk.py,v 1.1 2010/06/30 22:02:26 egor Exp $""" | ||
|
||
__version__ = "$Revision: 1.1 $"[11:-2] | ||
|
||
|
||
from Globals import DTMLFile | ||
from Globals import InitializeClass | ||
|
||
from Products.ZenUtils.Utils import convToUnits | ||
|
||
from Products.ZenRelations.RelSchema import * | ||
|
||
from Products.ZenModel.HWComponent import HWComponent | ||
from Products.ZenModel.ZenossSecurity import * | ||
|
||
def manage_addHardDisk(context, id, title = None, REQUEST = None): | ||
"""make a filesystem""" | ||
hd = HardDisk(id, title) | ||
context._setObject(id, hd) | ||
hd = context._getOb(id) | ||
|
||
if REQUEST is not None: | ||
REQUEST['RESPONSE'].redirect(context.absolute_url() | ||
+'/manage_main') | ||
|
||
addHardDisk = DTMLFile('dtml/addHardDisk',globals()) | ||
|
||
|
||
class LogicalDisk(HWComponent): | ||
"""LogicalDisk object""" | ||
|
||
portal_type = meta_type = 'LogicalDisk' | ||
|
||
manage_editHardDiskForm = DTMLFile('dtml/manageEditHardDisk',globals()) | ||
|
||
description = "" | ||
hostresindex = 0 | ||
size = 0 | ||
stripesize = 0 | ||
diskType = "" | ||
status = 1 | ||
|
||
_properties = HWComponent._properties + ( | ||
{'id':'description', 'type':'string', 'mode':'w'}, | ||
{'id':'hostresindex', 'type':'int', 'mode':'w'}, | ||
{'id':'diskType', 'type':'string', 'mode':'w'}, | ||
{'id':'size', 'type':'int', 'mode':'w'}, | ||
{'id':'stripesize', 'type':'int', 'mode':'w'}, | ||
{'id':'status', 'type':'int', 'mode':'w'}, | ||
) | ||
|
||
_relations = HWComponent._relations + ( | ||
("hw", ToOne(ToManyCont, "Products.ZenModel.DeviceHW", "logicaldisks")), | ||
) | ||
|
||
|
||
factory_type_information = ( | ||
{ | ||
'id' : 'LogicalDisk', | ||
'meta_type' : 'LogicalDisk', | ||
'description' : """Arbitrary device grouping class""", | ||
'icon' : 'HardDisk_icon.gif', | ||
'product' : 'deviceAdvDetail', | ||
'factory' : 'manage_addHardDisk', | ||
'immediate_view' : 'viewLogicalDisk', | ||
'actions' : | ||
( | ||
{ 'id' : 'status' | ||
, 'name' : 'Status' | ||
, 'action' : 'viewLogicalDisk' | ||
, 'permissions' : (ZEN_VIEW,) | ||
}, | ||
{ 'id' : 'perfConf' | ||
, 'name' : 'Template' | ||
, 'action' : 'objTemplates' | ||
, 'permissions' : (ZEN_CHANGE_DEVICE, ) | ||
}, | ||
{ 'id' : 'viewHistory' | ||
, 'name' : 'Modifications' | ||
, 'action' : 'viewHistory' | ||
, 'permissions' : (ZEN_VIEW_MODIFICATIONS,) | ||
}, | ||
) | ||
}, | ||
) | ||
|
||
def viewName(self): return self.description | ||
|
||
def sizeString(self): | ||
""" | ||
Return the number of total bytes in human readable form ie 10MB | ||
""" | ||
return convToUnits(self.size,divby=1000) | ||
|
||
def stripesizeString(self): | ||
""" | ||
Return the Stripes Size in human readable form ie 64Kb | ||
""" | ||
return convToUnits(self.stripesize) | ||
|
||
|
||
InitializeClass(LogicalDisk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
################################################################################ | ||
# | ||
# This program is part of the deviceAdvDetail Zenpack for Zenoss. | ||
# Copyright (C) 2008 Egor Puzanov. | ||
# | ||
# This program can be used under the GNU General Public License version 2 | ||
# You can find full information here: http://www.zenoss.com/oss | ||
# | ||
################################################################################ | ||
|
||
__doc__="""MemoryModule | ||
MemoryModule is an abstraction of a memorymodule. | ||
$Id: MemoryModule.py,v 1.0 2009/04/23 14:57:24 egor Exp $""" | ||
|
||
__version__ = "$Revision: 1.0 $"[11:-2] | ||
|
||
from Globals import InitializeClass | ||
|
||
from Products.ZenUtils.Utils import convToUnits | ||
|
||
from Products.ZenRelations.RelSchema import * | ||
|
||
from Products.ZenModel.HWComponent import HWComponent | ||
from Products.ZenModel.ZenossSecurity import * | ||
|
||
class MemoryModule(HWComponent): | ||
|
||
"""MemoryModule object""" | ||
|
||
portal_type = meta_type = 'MemoryModule' | ||
|
||
slot = 0 | ||
size = 0 | ||
status = 1 | ||
|
||
_properties = HWComponent._properties + ( | ||
{'id':'slot', 'type':'int', 'mode':'w'}, | ||
{'id':'size', 'type':'int', 'mode':'w'}, | ||
{'id':'status', 'type':'int', 'mode':'w'}, | ||
) | ||
|
||
_relations = HWComponent._relations + ( | ||
("hw", ToOne(ToManyCont, "Products.ZenModel.DeviceHW", "memorymodules")), | ||
) | ||
|
||
factory_type_information = ( | ||
{ | ||
'id' : 'MemoryModule', | ||
'meta_type' : 'MemoryModule', | ||
'description' : """Arbitrary device grouping class""", | ||
'icon' : 'MemoryModule_icon.gif', | ||
'product' : 'ZenModel', | ||
'factory' : 'manage_addMemoryModule', | ||
'immediate_view' : 'viewMemoryModule', | ||
'actions' : | ||
( | ||
{ 'id' : 'status' | ||
, 'name' : 'Status' | ||
, 'action' : 'viewMemoryModule' | ||
, 'permissions' : (ZEN_VIEW,) | ||
}, | ||
{ 'id' : 'perfConf' | ||
, 'name' : 'Template' | ||
, 'action' : 'objTemplates' | ||
, 'permissions' : (ZEN_CHANGE_DEVICE, ) | ||
}, | ||
{ 'id' : 'viewHistory' | ||
, 'name' : 'Modifications' | ||
, 'action' : 'viewHistory' | ||
, 'permissions' : (ZEN_VIEW_MODIFICATIONS,) | ||
}, | ||
) | ||
}, | ||
) | ||
|
||
def sizeString(self): | ||
""" | ||
Return the number of total bytes in human readable form ie 10MB | ||
""" | ||
if self.size > 0: | ||
return convToUnits(self.size) | ||
else: | ||
return '' | ||
|
||
InitializeClass(MemoryModule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
import Globals | ||
import os.path | ||
|
||
skinsDir = os.path.join(os.path.dirname(__file__), 'skins') | ||
from Products.CMFCore.DirectoryView import registerDirectory | ||
if os.path.isdir(skinsDir): | ||
registerDirectory(skinsDir, globals()) | ||
|
||
from Products.ZenModel.DeviceHW import DeviceHW | ||
from Products.ZenRelations.RelSchema import * | ||
DeviceHW._relations += (("memorymodules", ToManyCont(ToOne, "ZenPacks.community.deviceAdvDetail.MemoryModule", "hw")), ) | ||
DeviceHW._relations += (("logicaldisks", ToManyCont(ToOne, "ZenPacks.community.deviceAdvDetail.LogicalDisk", "hw")), ) | ||
|
||
from Products.ZenModel.ZenPack import ZenPackBase | ||
from Products.ZenUtils.ZenScriptBase import ZenScriptBase | ||
class ZenPack(ZenPackBase): | ||
""" ZenPack loader | ||
""" | ||
def install(self, app): | ||
self.dmd.Events.createOrganizer("/Change/Set/Status") | ||
ZenPackBase.install(self, app) | ||
for d in self.dmd.Devices.getSubDevices(): | ||
d.hw.buildRelations() | ||
|
||
def upgrade(self, app): | ||
self.dmd.Events.createOrganizer("/Change/Set/Status") | ||
ZenPackBase.upgrade(self, app) | ||
for d in self.dmd.Devices.getSubDevices(): | ||
d.hw.buildRelations() | ||
|
||
def remove(self, app, junk): | ||
ZenPackBase.remove(self, app, junk) | ||
DeviceHW._relations = tuple([x for x in DeviceHW._relations if x[0] not in ['memorymodules', 'logicaldisks']]) | ||
for d in self.dmd.Devices.getSubDevices(): | ||
d.hw.buildRelations() | ||
|
Oops, something went wrong.