Skip to content

Commit

Permalink
HP ProLiant Monitor 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
epuzanov committed Dec 26, 2010
1 parent e1671c6 commit 3a85408
Show file tree
Hide file tree
Showing 15 changed files with 28,055 additions and 9,042 deletions.
23 changes: 22 additions & 1 deletion ZenPacks.community.HPMon/ZenPacks/community/HPMon/__init__.py
Expand Up @@ -17,12 +17,33 @@ class ZenPack(ZenPackBase):
]


def install(self, app):
if hasattr(self.dmd.Reports, 'Device Reports'):
devReports = self.dmd.Reports['Device Reports']
rClass = devReports.getReportClass()
if not hasattr(devReports, 'HP ProLiant Reports'):
dc = rClass('HP ProLiant Reports', None)
devReports._setObject('HP ProLiant Reports', dc)
ZenPackBase.install(self, app)

def upgrade(self, app):
from ZenPacks.community.deviceAdvDetail.thresholds.StatusThreshold import StatusThreshold
for t in dmd.Devices.getAllRRDTemplates():
for t in self.dmd.Devices.getAllRRDTemplates():
for gt in t.thresholds():
if isinstance(gt, StatusThreshold): continue
if gt.id != '%s status'%t.id: continue
template.thresholds.removeRelation(gt)
if hasattr(self.dmd.Reports, 'Device Reports'):
devReports = self.dmd.Reports['Device Reports']
rClass = devReports.getReportClass()
if not hasattr(devReports, 'HP ProLiant Reports'):
dc = rClass('HP ProLiant Reports', None)
devReports._setObject('HP ProLiant Reports', dc)
ZenPackBase.upgrade(self, app)

def remove(self, app, junk):
ZenPackBase.remove(self, app, junk)
if hasattr(self.dmd.Reports, 'Device Reports'):
devReports = self.dmd.Reports['Device Reports']
if hasattr(devReports, 'HP ProLiant Reports'):
devReports._delObject('HP ProLiant Reports')
37 changes: 31 additions & 6 deletions ZenPacks.community.HPMon/ZenPacks/community/HPMon/cpqDaCntlr.py
Expand Up @@ -12,10 +12,11 @@
cpqDaCntlr is an abstraction of a HP Smart Array Controller.
$Id: cpqDaCntlr.py,v 1.1 2010/06/29 10:44:38 egor Exp $"""
$Id: cpqDaCntlr.py,v 1.2 2010/11/05 14:29:40 egor Exp $"""

__version__ = "$Revision: 1.1 $"[11:-2]
__version__ = "$Revision: 1.2 $"[11:-2]

import inspect
from HPExpansionCard import *

class cpqDaCntlr(HPExpansionCard):
Expand All @@ -27,15 +28,15 @@ class cpqDaCntlr(HPExpansionCard):
FWRev = ""
role = 1
redundancyType = ""

__ifindex = "1"

# we monitor RAID Controllers
monitor = True

statusmap ={1: (DOT_GREY, SEV_WARNING, 'other'),
2: (DOT_GREEN, SEV_CLEAN, 'Ok'),
3: (DOT_RED, SEV_CRITICAL, 'General Failure'),
4: (DOT_ORANGE, SEV_ERROR, 'Cable Problem'),
5: (DOT_RED, SEV_CRITICAL, 'Powered Off'),
3: (DOT_ORANGE, SEV_ERROR, 'Degraded'),
4: (DOT_RED, SEV_CRITICAL, 'Failed'),
}

_properties = HPExpansionCard._properties + (
Expand Down Expand Up @@ -84,4 +85,28 @@ def roleString(self):
}
return roles.get(self.role, roles[1])

def getRRDTemplates(self):
templates = []
tnames = ['cpqDaCntlr', 'cpqDaAccelCntlr', 'cpqDaCntlrPerf']
for tname in tnames:
templ = self.getRRDTemplateByName(tname)
if templ: templates.append(templ)
return templates

def _getSnmpIndex(self):
frame = inspect.currentframe(2)
try:
if 'templ' in frame.f_locals:
if frame.f_locals['templ'].id != 'cpqDaCntlrPerf': ifindex = ''
else: ifindex = '.' + self.__ifindex
finally: del frame
return self.snmpindex + ifindex

def _setSnmpIndex(self, value):
self.__ifindex = value

ifindex = property(fget=lambda self: self._getSnmpIndex(),
fset=lambda self, v: self._setSnmpIndex(v)
)

InitializeClass(cpqDaCntlr)
32 changes: 29 additions & 3 deletions ZenPacks.community.HPMon/ZenPacks/community/HPMon/cpqDaLogDrv.py
Expand Up @@ -12,17 +12,19 @@
cpqDaLogDrv is an abstraction of a HP DA Logical Disk.
$Id: cpqDaLogDrv.py,v 1.1 2010/06/30 16:18:48 egor Exp $"""
$Id: cpqDaLogDrv.py,v 1.2 2010/11/10 16:56:46 egor Exp $"""

__version__ = "$Revision: 1.1 $"[11:-2]
__version__ = "$Revision: 1.2 $"[11:-2]

#from Globals import InitializeClass
import inspect
from HPLogicalDisk import *

class cpqDaLogDrv(HPLogicalDisk):
"""cpqDaLogDrv object
"""

__ifindex = "1"

statusmap ={1: (DOT_GREY, SEV_WARNING, 'other'),
2: (DOT_GREEN, SEV_CLEAN, 'Ok'),
3: (DOT_RED, SEV_CRITICAL, 'Failed'),
Expand All @@ -40,4 +42,28 @@ class cpqDaLogDrv(HPLogicalDisk):
15:(DOT_ORANGE, SEV_ERROR, 'Multi-path Access Degraded'),
}

def getRRDTemplates(self):
templates = []
tnames = ['cpqDaLogDrv', 'cpqDaLogDrvPerf']
for tname in tnames:
templ = self.getRRDTemplateByName(tname)
if templ: templates.append(templ)
return templates

def _getSnmpIndex(self):
frame = inspect.currentframe(2)
try:
if 'templ' in frame.f_locals:
if frame.f_locals['templ'].id != 'cpqDaLogDrvPerf': ifindex = ''
else: ifindex = '.' + self.__ifindex
finally: del frame
return self.snmpindex + ifindex

def _setSnmpIndex(self, value):
self.__ifindex = value

ifindex = property(fget=lambda self: self._getSnmpIndex(),
fset=lambda self, v: self._setSnmpIndex(v)
)

InitializeClass(cpqDaLogDrv)
@@ -0,0 +1,59 @@
################################################################################
#
# This program is part of the HPMon 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__="""cpqHeResMem2Module
cpqHeResMem2Module is an abstraction of a Memory Module.
$Id: cpqHeResMem2Module.py,v 1.0 2010/11/09 12:52:04 egor Exp $"""

__version__ = "$Revision: 1.0 $"[11:-2]

from ZenPacks.community.deviceAdvDetail.MemoryModule import *
from HPComponent import *

class cpqHeResMem2Module(MemoryModule, HPComponent):
"""MemoryModule object"""

portal_type = meta_type = 'MemoryModule'

status = 1

# we monitor Memory modules
monitor = True

statusmap ={1: (DOT_GREY, SEV_WARNING, 'other'),
2: (DOT_GREY, SEV_WARNING, 'Not Present'),
3: (DOT_YELLOW, SEV_WARNING, 'Present'),
4: (DOT_GREEN, SEV_CLEAN, 'Good'),
5: (DOT_YELLOW, SEV_WARNING, 'Add'),
6: (DOT_YELLOW, SEV_WARNING, 'Upgraded'),
7: (DOT_RED, SEV_CRITICAL, 'Missing'),
8: (DOT_RED, SEV_CRITICAL, 'Dos not Match'),
9: (DOT_RED, SEV_CRITICAL, 'Not Supported'),
10:(DOT_RED, SEV_CRITICAL, 'Bad Config'),
11:(DOT_ORANGE, SEV_ERROR, 'Degraded'),
}

_properties = MemoryModule._properties + (
{'id':'status', 'type':'int', 'mode':'w'},
)

def getRRDTemplates(self):
"""
Return the RRD Templates list
"""
templates = []
for tname in [self.__class__.__name__]:
templ = self.getRRDTemplateByName(tname)
if templ: templates.append(templ)
return templates

InitializeClass(cpqHeResMem2Module)
Expand Up @@ -80,4 +80,10 @@ class cpqSm2Cntlr(HPExpansionCard):
},
)

def getDeviceProductName(self):
return self.device().hw.getProductName()

def getDeviceProductLink(self):
return self.device().hw.getProductLink()

InitializeClass(cpqSm2Cntlr)
@@ -0,0 +1,34 @@
################################################################################
#
# This program is part of the HPMon 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
#
################################################################################

from Products.ZenModel.ZenPack import ZenPackMigration
from Products.ZenModel.migrate.Migrate import Version

class removeIOBytesGraphDef( ZenPackMigration ):
"""
remove IO Bytes GraphDef from RRDTemplates
"""
version = Version(2, 1)

def migrate(self, pack):

hpTemplates = [ 'cpqDaPhyDrv',
'cpqFcaPhyDrv',
'cpqScsiPhyDrv',
]

for template in pack.dmd.Devices.Server.getAllRRDTemplates():
if template.id not in hpTemplates: continue
if hasattr(template.graphDefs, 'IO Bytes'):
template.graphDefs._delObject('IO Bytes')
if hasattr(template.graphs, 'IO Bytes'):
template.graphs._delObject('IO Bytes')

removeIOBytesGraphDef()
@@ -0,0 +1,35 @@
################################################################################
#
# This program is part of the HPMon 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__='''
Delete the previous HP iLO Boards and HP Storage Controllers reports.
$Id:$
'''
from Products.ZenModel.ZenPack import ZenPackMigration
from Products.ZenModel.migrate.Migrate import Version

class removeOldHPReports(ZenPackMigration):
version = Version(2, 1)

def migrate(self, pack):
if hasattr(pack.dmd.Reports, 'Device Reports'):
devReports = pack.dmd.Reports['Device Reports']

if hasattr(devReports, 'HP iLO Boards'):
devReports._delObject('HP iLO Boards')

if hasattr(devReports, 'HP Storage Controllers'):
devReports._delObject('HP Storage Controllers')

removeOldHPReports()


@@ -1,15 +1,12 @@
###########################################################################
################################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, 2008, Zenoss Inc.
# This program is part of the HPMon Zenpack for Zenoss.
# Copyright (C) 2008, 2009, 2010 Egor Puzanov.
#
# 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 can be used under the GNU General Public License version 2
# You can find full information here: http://www.zenoss.com/oss
#
# For complete information please visit: http://www.zenoss.com/oss/
#
###########################################################################
################################################################################

import Globals
from Products.ZenModel.ZenPack import ZenPackMigration
Expand All @@ -27,8 +24,6 @@ class updateTemplatesWithStatusThreshold( ZenPackMigration ):


def migrate(self, pack):
dmd = pack.__primary_parent__.__primary_parent__

hpTemplates = [ 'cpqDaCntlr',
'cpqDaLogDrv',
'cpqDaPhyDrv',
Expand Down Expand Up @@ -58,7 +53,7 @@ def migrate(self, pack):
]

# Update existing templates to use the new StatusThreshold
for template in dmd.Devices.Server.getAllRRDTemplates():
for template in pack.dmd.Devices.Server.getAllRRDTemplates():
if template.id not in hpTemplates: continue
for threshold in template.thresholds():
if isinstance(threshold, StatusThreshold): continue
Expand Down
@@ -1,7 +1,7 @@
################################################################################
#
# This program is part of the HPMon Zenpack for Zenoss.
# Copyright (C) 2008 Egor Puzanov.
# 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
Expand All @@ -12,9 +12,9 @@
HPDaCntlrMap maps the cpqDaCntlrTable table to cpqDaCntlr objects
$Id: HPDaCntlrMap.py,v 1.1 2009/08/18 16:38:53 egor Exp $"""
$Id: HPDaCntlrMap.py,v 1.2 2010/11/05 14:33:55 egor Exp $"""

__version__ = '$Revision: 1.1 $'[11:-2]
__version__ = '$Revision: 1.2 $'[11:-2]

from Products.ZenUtils.Utils import convToUnits
from Products.DataCollector.plugins.CollectorPlugin import GetTableMap
Expand All @@ -33,8 +33,8 @@ class HPDaCntlrMap(HPExpansionCardMap):
'.2': 'model',
'.3': 'FWRev',
'.5': 'slot',
'.6': 'status',
'.9': 'role',
'.10': 'status',
'.15': 'serialNumber',
'.16': 'redundancyType',
}
Expand Down

0 comments on commit 3a85408

Please sign in to comment.