当前位置: 首页>>代码示例>>Python>>正文


Python IGUIDManager.perfServer方法代码示例

本文整理汇总了Python中Products.ZenUtils.guid.interfaces.IGUIDManager.perfServer方法的典型用法代码示例。如果您正苦于以下问题:Python IGUIDManager.perfServer方法的具体用法?Python IGUIDManager.perfServer怎么用?Python IGUIDManager.perfServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.ZenUtils.guid.interfaces.IGUIDManager的用法示例。


在下文中一共展示了IGUIDManager.perfServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getProcessList

# 需要导入模块: from Products.ZenUtils.guid.interfaces import IGUIDManager [as 别名]
# 或者: from Products.ZenUtils.guid.interfaces.IGUIDManager import perfServer [as 别名]
 def getProcessList(self, deviceGuid):
     if deviceGuid and len(deviceGuid) > 0:
         s = ''
         try:
             import subprocess
             from Products.ZenUtils.Utils import binPath
             device = IGUIDManager(self._dmd).getObject(deviceGuid)
             s = '# ' + device.id
             zenmodelerOpts = ['run', '--now', '--debug', '-v10', '-d', device.id]
             isPerfMonRemote = False
             zenmodelerName = 'zenmodeler'
             zenmodelerPath = binPath(zenmodelerName)
             monitorId = device.perfServer().id
             if monitorId != 'localhost':
                 zenmodelerName = monitorId + '_' + zenmodelerName
                 zenmodelerPath = binPath(zenmodelerName)
                 if len(zenmodelerPath) == 0:
                     isPerfMonRemote = True
             if isPerfMonRemote:
                 cmd = "ssh %s %s %s" % (device.perfServer().hostname, zenmodelerName, ' '.join(zenmodelerOpts))
             else:
                 cmd = "%s %s" % (zenmodelerPath, ' '.join(zenmodelerOpts))
             processList = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT).splitlines()
             filterProcessLine = re.compile('DEBUG zen\.osprocessmatcher: COMMAND LINE: (?P<process>.*)$')
             for processListLine in processList:
                 m = filterProcessLine.search(processListLine)
                 if m:
                     s += '\n' + m.group('process')
         except Exception, e:
             s += '\n# ' + str(e)
         yield {
            'uid': '0',
            'process': s
         }
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:36,代码来源:processfacade.py

示例2: getProcessList

# 需要导入模块: from Products.ZenUtils.guid.interfaces import IGUIDManager [as 别名]
# 或者: from Products.ZenUtils.guid.interfaces.IGUIDManager import perfServer [as 别名]
 def getProcessList(self, deviceGuid):
     if deviceGuid and len(deviceGuid) > 0:
         s = ''
         try:
             device = IGUIDManager(self._dmd).getObject(deviceGuid)
             s = '# ' + device.id
             response = Response()
             zenmodelerOpts = ['run', '--now', '--debug', '-v10', '-d', device.id]
             exitCode = device.perfServer().executeCollectorCommand('zenmodeler', zenmodelerOpts, REQUEST=None, write=response.write)
             processList = response.getLines()
             if not exitCode:
                 filterProcessLine = re.compile('DEBUG zen\.osprocessmatcher: COMMAND LINE: (?P<process>.*)$')
                 for processListLine in processList:
                     m = filterProcessLine.search(processListLine)
                     if m:
                         s += '\n' + m.group('process')
             else:
                 s += "==> " + str(exitCode)
                 for line in processList:
                     s += '\n# ' + line.strip()
         except Exception, e:
             s += '\n# ' + str(e)
         yield {
            'uid': '0',
            'process': s
         }
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:28,代码来源:processfacade.py


注:本文中的Products.ZenUtils.guid.interfaces.IGUIDManager.perfServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。