本文整理汇总了Python中Products.ZenUtils.guid.interfaces.IGUIDManager.getPerformanceServerName方法的典型用法代码示例。如果您正苦于以下问题:Python IGUIDManager.getPerformanceServerName方法的具体用法?Python IGUIDManager.getPerformanceServerName怎么用?Python IGUIDManager.getPerformanceServerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZenUtils.guid.interfaces.IGUIDManager
的用法示例。
在下文中一共展示了IGUIDManager.getPerformanceServerName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getProcessList
# 需要导入模块: from Products.ZenUtils.guid.interfaces import IGUIDManager [as 别名]
# 或者: from Products.ZenUtils.guid.interfaces.IGUIDManager import getPerformanceServerName [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':
isPerfMonRemote = True
if isPerfMonRemote:
cmd = 'zminion --minion-name zminion_%s run -- "%s %s"' % (device.getPerformanceServerName(), 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
}