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

Source Code for Module 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  import re 
23   
24  from Products.DataCollector.ObjectMap import ObjectMap 
25  from Products.DataCollector.RelationshipMap import RelationshipMap 
26   
27  from Products.ZenUtils.Utils import prepId as globalPrepId 
28   
29 -class CommandParser:
30 31 #Subclasses must fill this in with appropriate command 32 command = '' 33
34 - def prepId(self, id, subchar='_'):
35 return globalPrepId(id, subchar)
36
37 - def newObjectMap(self, className=None):
38 return ObjectMap(className)
39
40 - def newRelationshipMap(self, relationshipName, componentName=""):
41 return RelationshipMap(relationshipName, componentName)
42
43 - def condition(self, device, snmpsess):
44 """does device meet the proper conditions for this collector to run""" 45 return 0
46 47
48 - def parse(self, results, log):
49 """collect snmp information from this device 50 device is the a Device class (or subclass) object 51 snmpsess is a valid instance of SnmpSession to connect 52 to this device""" 53 pass
54 55
56 - def description(self):
57 """return a description of what this map does""" 58 pass
59