Skip to content

Commit

Permalink
Initial checkin of HP Systems Insight Agents Monitor ZenPack
Browse files Browse the repository at this point in the history
git-svn-id: http://zenpacks.zenoss.org/svn/zenpacks@68 db08cffe-75b9-45d1-af1a-46ad9ef135f6
  • Loading branch information
Mike Albon committed Dec 31, 2008
0 parents commit c6758ce
Show file tree
Hide file tree
Showing 28 changed files with 2,634 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ZenPacks.community.HPSIMMonitor.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: ZenPacks.community.HPSIMMonitor
Version: 1.1
Summary: UNKNOWN
Home-page: UNKNOWN
Author: Mike Albon
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
21 changes: 21 additions & 0 deletions ZenPacks.community.HPSIMMonitor.egg-info/SOURCES.txt
@@ -0,0 +1,21 @@
setup.py
ZenPacks/__init__.py
ZenPacks.community.HPSIMMonitor.egg-info/PKG-INFO
ZenPacks.community.HPSIMMonitor.egg-info/SOURCES.txt
ZenPacks.community.HPSIMMonitor.egg-info/dependency_links.txt
ZenPacks.community.HPSIMMonitor.egg-info/entry_points.txt
ZenPacks.community.HPSIMMonitor.egg-info/namespace_packages.txt
ZenPacks.community.HPSIMMonitor.egg-info/not-zip-safe
ZenPacks.community.HPSIMMonitor.egg-info/top_level.txt
ZenPacks/community/__init__.py
ZenPacks/community/HPSIMMonitor/HPTemperatureSensor.py
ZenPacks/community/HPSIMMonitor/__init__.py
ZenPacks/community/HPSIMMonitor/datasources/__init__.py
ZenPacks/community/HPSIMMonitor/lib/__init__.py
ZenPacks/community/HPSIMMonitor/migrate/__init__.py
ZenPacks/community/HPSIMMonitor/modeler/__init__.py
ZenPacks/community/HPSIMMonitor/modeler/plugins/__init__.py
ZenPacks/community/HPSIMMonitor/modeler/plugins/community/__init__.py
ZenPacks/community/HPSIMMonitor/modeler/plugins/community/snmp/HPDeviceTemplateMap.py
ZenPacks/community/HPSIMMonitor/modeler/plugins/community/snmp/HPSIMTemperatureMap.py
ZenPacks/community/HPSIMMonitor/modeler/plugins/community/snmp/__init__.py
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions ZenPacks.community.HPSIMMonitor.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
[zenoss.zenpacks]
ZenPacks.community.HPSIMMonitor = ZenPacks.community.HPSIMMonitor

@@ -0,0 +1,2 @@
ZenPacks
ZenPacks.community
1 change: 1 addition & 0 deletions ZenPacks.community.HPSIMMonitor.egg-info/not-zip-safe
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ZenPacks.community.HPSIMMonitor.egg-info/top_level.txt
@@ -0,0 +1 @@
ZenPacks
1 change: 1 addition & 0 deletions ZenPacks/__init__.py
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
30 changes: 30 additions & 0 deletions ZenPacks/community/HPSIMMonitor/HPTemperatureSensor.py
@@ -0,0 +1,30 @@
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, Zenoss Inc.
#
# 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.
#
# For complete information please visit: http://www.zenoss.com/oss/
#
###########################################################################

__doc__="""HPTemperatureSensor
HPTemperatureSensor is a variation of the standard temperature sensor class.
It allows HP specific temperature sensors not to clash with other vendors.
$Id: HPTemperatureSensor.py,v 1.00 2008/11/03 16:56:00 mikea Exp $"""

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

from Products.ZenModel.TemperatureSensor import *

class HPTemperatureSensor(TemperatureSensor):
"""
HP Systems Insight Manager Temperature Sensor
"""

InitializeClass(HPTemperatureSensor)
1 change: 1 addition & 0 deletions ZenPacks/community/HPSIMMonitor/MANIFEST.in
@@ -0,0 +1 @@
graft ZenPacks
8 changes: 8 additions & 0 deletions ZenPacks/community/HPSIMMonitor/__init__.py
@@ -0,0 +1,8 @@

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())
2 changes: 2 additions & 0 deletions ZenPacks/community/HPSIMMonitor/datasources/__init__.py
@@ -0,0 +1,2 @@
# __init__.py

1 change: 1 addition & 0 deletions ZenPacks/community/HPSIMMonitor/lib/__init__.py
@@ -0,0 +1 @@
# __init__.py
1 change: 1 addition & 0 deletions ZenPacks/community/HPSIMMonitor/migrate/__init__.py
@@ -0,0 +1 @@
# __init__.py
@@ -0,0 +1,76 @@
__doc__="""HPDeviceTemplateMap
HPDeviceTemplate maps the total CPU column in Systems Insight Manager
$Id: HPDeviceTemplate.py,v 1.00 2008/06/13 16:01 mikea Exp $"""

__version__ = '$Revision: 1.00 $'

from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetTableMap, GetMap
#import transaction

class HPDeviceTemplateMap(SnmpPlugin):

#maptype = 'DeviceMap'
deviceProperties = SnmpPlugin.deviceProperties + ('zDeviceTemplates',)
columns = {
'.1': 'snmpindex',
'.2': 'cpuName',
'.4': 'cpuPercentProcessorTime'
}

devcolumns = {
'.1.3.6.1.4.1.9600.1.1.5.1.5.6.95.84.111.116.97.108': 'cpuTime'
}

snmpGetTableMaps = (
GetTableMap('winos-cpu-table','.1.3.6.1.4.1.232.19.2.3.2.1', columns),
)

snmpGetMap = GetMap(devcolumns)

def process(self, device, results, log):
"""collect snmp information from this device"""
#log.info(dir(device))
#log.info(str(self.deviceProperties))
log.info('processing %s for device %s', self.name(), device.id)
#templates = device.zDeviceTemplates
getdata, tabledata = results
cputable = tabledata.get('winos-cpu-table')
CTemplates = getattr(device, 'zDeviceTemplates',None)
#log.debug(str(device.zDeviceTemplates))
#tom is the Temprary Object Map. This allows us to check if cpu information is provided by SNMP-Informant
log.debug('---- Checking for SNMP-Informant data ----')
tom = self.objectMap(getdata)
#log.debug(tom.items())
if 'cpuTime' not in tom.items():
log.debug('==== No SNMP-Informant Mib data retrieved ====')
else:
log.debug('==== SNMP-Informant data retrieved ====')
Template = 'Device'
log.debug('---- Processing SIM CPU Table ----')
Template = ''
for ifindex, data in cputable.items():
log.debug('Processor index %s is %s', data['snmpindex'], data['cpuName'])
if data['cpuName'] == '_Total':
if ifindex == '2':
Template = 'HPDevice1'
elif ifindex == '3':
Template = 'HPDevice2'
elif ifindex == '5':
Template = 'HPDevice4'
else:
Template = 'Device'
if Template == '':
Template = 'Device'
log.debug('Selected Template is: %s' % Template)
log.debug('Current Device Templaces: %s' % str(device.zDeviceTemplates))
newTemplates = []
for each in device.zDeviceTemplates:
if each in ['Device','HPDevice1','HPDevice2','HPDevice4']:
newTemplates.append(Template)
else:
newTemplates.append(each)
om = self.objectMap({'bindTemplates': newTemplates})
return om

@@ -0,0 +1,96 @@
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, Zenoss Inc.
#
# 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.
#
# For complete information please visit: http://www.zenoss.com/oss/
#
###########################################################################

from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetTableMap, GetMap

class HPSIMTemperatureMap(SnmpPlugin):
"""Map HP insight manager temperature table to model."""

maptype = "HPSIMTemperatureMap"
meta_type = "HPTemperatureSensor"
modname = "ZenPacks.community.HPSIMMonitor.HPTemperatureSensor"
relname = "temperaturesensors"
compname = "hw"

# ocolumns = {
# '1':'cpqHeTemperatureChassis',
# '2':'cpqHeTemperatureIndex',
# '3':'cpqHeTemperatureLocale',
# '4':'cpqHeTemperatureThreshold',
# '5':'cpqHeTemperatureCondition',
# '6':'cpqHeTemperatureThresholdType',
# '7':'cpqHeTemperatureHwLocation'
# }

columns = {
'.1':'chassis',
'.2':'snmpindex',
'.3':'locale',
'.6':'state',
# '.7':'hwlocation'
}

sensorLocale = {
1:'other',
2:'unknown',
3:'system',
4:'systemBoard',
5:'ioBoard',
6:'cpu',
7:'memory',
8:'storage',
9:'removableMedia',
10:'powerSupply',
11:'ambient',
12:'chassis',
13:'bridgeCard'
}

conditions = {
0:'other',
2:'ok',
3:'degraded',
4:'failed'
}

snmpGetTableMaps = (
GetTableMap('hp-temp-table', '.1.3.6.1.4.1.232.6.2.6.8.1', columns),
)

def process(self, device, results, log):
"""collect snmp information from this device"""
getdata, tabledata = results
temptable = tabledata.get("hp-temp-table")
log.info('processing %s for device %s', self.name(), device.id)
names = {}
if not temptable: return
rm = self.relMap()
for sensor in temptable.values():
try:
newsensor={}
newsensor['snmpindex'] = '%s.%s' % (sensor['chassis'],sensor['snmpindex'])
if not sensor.has_key('hwlocation'):
if sensor['locale'] not in names:
names[sensor['locale']] = 0
newsensor['id'] = '%s %s' % (self.sensorLocale[sensor['locale']],str(names[sensor['locale']]))
names[sensor['locale']] = names[sensor['locale']] + 1
else:
newsensor['id'] = sensor['hwlocation']
newsensor['state'] = self.conditions.get(sensor['state'],'unknown')
newsensor['id'] = self.prepId(newsensor['id'])
om = self.objectMap(newsensor)
except AttributeError:
continue
rm.append(om)
return rm

0 comments on commit c6758ce

Please sign in to comment.