Skip to content

Commit

Permalink
CiscoCatalyst 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kells Kearney committed Oct 28, 2010
0 parents commit 56067a2
Show file tree
Hide file tree
Showing 18 changed files with 638 additions and 0 deletions.
17 changes: 17 additions & 0 deletions COPYRIGHT.txt
@@ -0,0 +1,17 @@

All files in this directory and below are:

Copyright (c) 2008, 2009, 2010 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.
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -0,0 +1 @@
graft ZenPacks
8 changes: 8 additions & 0 deletions ZenPacks/Nova/Cisco/Catalyst/__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/Nova/Cisco/Catalyst/datasources/__init__.py
@@ -0,0 +1,2 @@
# __init__.py

1 change: 1 addition & 0 deletions ZenPacks/Nova/Cisco/Catalyst/lib/__init__.py
@@ -0,0 +1 @@
# __init__.py
1 change: 1 addition & 0 deletions ZenPacks/Nova/Cisco/Catalyst/migrate/__init__.py
@@ -0,0 +1 @@
# __init__.py
Empty file.
Empty file.
Empty file.
@@ -0,0 +1,61 @@
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, 2009, 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__ = """InterfaceCatOsMap
Extends the standard InterfaceMap to use 1.3.6.1.4.1.9.5.1.4.1.1.4
(the CatOS interface description) as the interface's description
instead of the standard interface description. Also uses ifName
instead of ifDescr.
"""

from copy import deepcopy
from Products.DataCollector.plugins.zenoss.snmp.InterfaceMap \
import InterfaceMap
from Products.DataCollector.plugins.CollectorPlugin import GetTableMap

class InterfaceCatOsMap(InterfaceMap):

snmpGetTableMaps = InterfaceMap.baseSnmpGetTableMaps + (
# Extended interface information.
GetTableMap('ifalias', '.1.3.6.1.2.1.31.1.1.1',
{'.1' : 'ifName',
'.6' : 'ifHCInOctets',
'.7' : 'ifHCInUcastPkts',
'.15': 'highSpeed'}
),
GetTableMap('ifcatos', '.1.3.6.1.4.1.9.5.1.4.1.1',
{'.11' : 'ifindex',
'.4' : 'description'}
),
)

def process(self, device, results, log):
"""
Pre-process the IF-MIB ifXTable to use the ifAlias as the interface's
name instead of the ifDescr. Also to use description from alternate OIDs.
"""

if 'ifalias' in results[1] and 'iftable' in results[1]:
for a_idx, alias in results[1]['ifalias'].items():
for i_idx, iface in results[1]['iftable'].items():
if a_idx == i_idx:
results[1]['iftable'][i_idx]['id'] = alias['ifName']

if 'ifcatos' in results[1] and 'iftable' in results[1]:
for a_idx, catos in results[1]['ifcatos'].items():
for i_idx, iface in results[1]['iftable'].items():
if catos['ifindex'] == iface['ifindex']:
results[1]['ifalias'][i_idx]['description'] = catos['description']

return super(InterfaceCatOsMap, self).process(device, results, log)
Empty file.

0 comments on commit 56067a2

Please sign in to comment.