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

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

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  __doc__ = """CommandParser
    15
    16  CommandParser parses the output of a command to return a datamap
    17
    18  $Id: CommandParser.py,v 1.1 2003/09/25 16:21:52 edahl Exp $"""
    19
    20  __version__ = '$Revision: 1.1 $'[11:-2]
    21
    22  from Products.DataCollector.ObjectMap import ObjectMap
    23  from Products.DataCollector.RelationshipMap import RelationshipMap
    24
    25  from Products.ZenUtils.Utils import prepId as globalPrepId
    26
    27 -class CommandParser:
    28
    29      #Subclasses must fill this in with appropriate command
    30      command = ''
    31
    32 -    def prepId(self, id, subchar='_'):
    33          return globalPrepId(id, subchar)
    34
    35 -    def newObjectMap(self, className=None):
    36          return ObjectMap(className)
    37
    38 -    def newRelationshipMap(self, relationshipName, componentName=""):
    39          return RelationshipMap(relationshipName, componentName)
    40
    41 -    def condition(self, device, snmpsess):
    42          """does device meet the proper conditions for this collector to run"""
    43          return 0
    44
    45
    46 -    def parse(self, results, log):
    47          """collect snmp information from this device
    48          device is the a Device class (or subclass) object
    49          snmpsess is a valid instance of SnmpSession to connect
    50          to this device"""
    51          pass
    52
    53
    54 -    def description(self):
    55          """return a description of what this map does"""
    56          pass
    57