Package DataCollector :: Module ProcessCommandPlugin
[hide private]
[frames] | no frames]

Source Code for Module DataCollector.ProcessCommandPlugin

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2009, 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   
15  from pprint import pformat 
16   
17  from Products.DataCollector.plugins.CollectorPlugin import CommandPlugin 
18   
19   
20 -class ProcessCommandPlugin(CommandPlugin):
21 """ 22 Base class for Linux and AIX command plugins for parsing ps command output 23 and modeling processes. 24 """ 25 26 compname = "os" 27 relname = "processes" 28 modname = "Products.ZenModel.OSProcess" 29 classname = "createFromObjectMap" 30
31 - def process(self, device, results, log):
32 33 log.info('Collecting process information for device %s' % device.id) 34 relMap = self.relMap() 35 36 for line in results.splitlines(): 37 38 words = line.split() 39 40 relMap.append(self.objectMap({ 41 "procName": words[0], 42 "parameters": " ".join(words[1:])})) 43 44 log.debug("First three modeled processes:\n%s" % 45 pformat(relMap.maps[:3])) 46 47 return relMap
48