本文整理匯總了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
}