Package Products :: Package DataCollector :: Package CommandParsers :: Module CommandParser |
[hide private]
[frames] | no frames]

# Source Code for Module Products.DataCollector.CommandParsers.CommandParser

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__ = """CommandParser
    12
    13  CommandParser parses the output of a command to return a datamap
    14
    15  $Id: CommandParser.py,v 1.1 2003/09/25 16:21:52 edahl Exp $"""
    16
    17  __version__ = '$Revision: 1.1 $'[11:-2]
    18
    19  from Products.DataCollector.ObjectMap import ObjectMap
    20  from Products.DataCollector.RelationshipMap import RelationshipMap
    21
    22  from Products.ZenUtils.Utils import prepId as globalPrepId
    23
    24 -class CommandParser:
    25
    26      #Subclasses must fill this in with appropriate command
    27      command = ''
    28
    29 -    def prepId(self, id, subchar='_'):
    30          return globalPrepId(id, subchar)
    31
    32 -    def newObjectMap(self, className=None):
    33          return ObjectMap(className)
    34
    35 -    def newRelationshipMap(self, relationshipName, componentName=""):
    36          return RelationshipMap(relationshipName, componentName)
    37
    38 -    def condition(self, device, snmpsess):
    39          """does device meet the proper conditions for this collector to run"""
    40          return 0
    41
    42
    43 -    def parse(self, results, log):
    44          """collect snmp information from this device
    45          device is the a Device class (or subclass) object
    46          snmpsess is a valid instance of SnmpSession to connect
    47          to this device"""
    48          pass
    49
    50
    51 -    def description(self):
    52          """return a description of what this map does"""
    53          pass
    54