本文整理汇总了Python中Utils.LadDiagnosticUtil.generatePerformanceCounterConfigurationFromLadCfg方法的典型用法代码示例。如果您正苦于以下问题:Python LadDiagnosticUtil.generatePerformanceCounterConfigurationFromLadCfg方法的具体用法?Python LadDiagnosticUtil.generatePerformanceCounterConfigurationFromLadCfg怎么用?Python LadDiagnosticUtil.generatePerformanceCounterConfigurationFromLadCfg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.LadDiagnosticUtil
的用法示例。
在下文中一共展示了LadDiagnosticUtil.generatePerformanceCounterConfigurationFromLadCfg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generatePerformanceCounterConfiguration
# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import generatePerformanceCounterConfigurationFromLadCfg [as 别名]
def generatePerformanceCounterConfiguration(mdsdCfg, includeAI=False):
perfCfgList = []
try:
ladCfg = readPublicConfig("ladCfg")
perfCfgList = LadUtil.generatePerformanceCounterConfigurationFromLadCfg(ladCfg)
if not perfCfgList:
perfCfgList = readPublicConfig("perfCfg")
if not perfCfgList and not hasPublicConfig("perfCfg"):
perfCfgList = [
{
"query": "SELECT PercentAvailableMemory, AvailableMemory, UsedMemory ,PercentUsedSwap FROM SCX_MemoryStatisticalInformation",
"table": "LinuxMemory",
},
{
"query": "SELECT PercentProcessorTime, PercentIOWaitTime, PercentIdleTime FROM SCX_ProcessorStatisticalInformation WHERE Name='_TOTAL'",
"table": "LinuxCpu",
},
{
"query": "SELECT AverageWriteTime,AverageReadTime,ReadBytesPerSecond,WriteBytesPerSecond FROM SCX_DiskDriveStatisticalInformation WHERE Name='_TOTAL'",
"table": "LinuxDisk",
},
]
except Exception, e:
hutil.error(
"Failed to parse performance configuration with exception:{0} {1}".format(e, traceback.format_exc())
)
示例2: _apply_perf_cfgs
# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import generatePerformanceCounterConfigurationFromLadCfg [as 别名]
def _apply_perf_cfgs(self, include_app_insights=False):
"""
Extract the 'perfCfg' settings from ext_settings and apply them to mdsd config XML root.
:param include_app_insights: Indicates whether perf counter settings for AppInsights should be included or not.
:return: None. Changes are applied directly to the mdsd config XML tree member.
"""
assert self._mdsd_config_xml_tree is not None
perf_cfgs = []
default_perf_cfgs = [
{"query": "SELECT PercentAvailableMemory, AvailableMemory, UsedMemory, PercentUsedSwap "
"FROM SCX_MemoryStatisticalInformation",
"table": "LinuxMemory"},
{"query": "SELECT PercentProcessorTime, PercentIOWaitTime, PercentIdleTime "
"FROM SCX_ProcessorStatisticalInformation WHERE Name='_TOTAL'",
"table": "LinuxCpu"},
{"query": "SELECT AverageWriteTime,AverageReadTime,ReadBytesPerSecond,WriteBytesPerSecond "
"FROM SCX_DiskDriveStatisticalInformation WHERE Name='_TOTAL'",
"table": "LinuxDisk"}
]
try:
# First try to get perf cfgs from the new 'ladCfg' setting.
lad_cfg = self._ext_settings.read_public_config('ladCfg')
perf_cfgs = LadUtil.generatePerformanceCounterConfigurationFromLadCfg(lad_cfg)
# If none, try the original 'perfCfg' setting.
if not perf_cfgs:
perf_cfgs = self._ext_settings.read_public_config('perfCfg')
# If none, use default (3 OMI queries)
if not perf_cfgs and not self._ext_settings.has_public_config('perfCfg'):
perf_cfgs = default_perf_cfgs
except Exception as e:
self._logger_error("Failed to parse performance configuration with exception:{0}\n"
"Stacktrace: {1}".format(e, traceback.format_exc()))
try:
self._update_perf_counters_settings(perf_cfgs)
if include_app_insights:
self._update_perf_counters_settings(perf_cfgs, True)
except Exception as e:
self._logger_error("Failed to create perf config. Error:{0}\n"
"Stacktrace: {1}".format(e, traceback.format_exc()))