def _update_perf_counters_settings(self, omi_queries, for_app_insights=False): """ Update the mdsd XML tree with the OMI queries provided. :param omi_queries: List of dictionaries specifying OMI queries and destination tables. E.g.: [ {"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"} ] :param for_app_insights: Indicates whether we are updating perf counters settings for AppInsights. AppInsights requires specific names, so we need this. :return: None. The mdsd XML tree member is updated accordingly. """ assert self._mdsd_config_xml_tree is not None if not omi_queries: return mdsd_omi_query_schema = """ <OMIQuery cqlQuery="" dontUsePerNDayTable="true" eventName="" omiNamespace="" priority="High" sampleRateInSeconds="" /> """ for omi_query in omi_queries: mdsd_omi_query_element = XmlUtil.createElement(mdsd_omi_query_schema) mdsd_omi_query_element.set('cqlQuery', omi_query['query']) mdsd_omi_query_element.set('eventName', omi_query['table']) namespace = omi_query['namespace'] if 'namespace' in omi_query else 'root/scx' mdsd_omi_query_element.set('omiNamespace', namespace) if for_app_insights: AIUtil.updateOMIQueryElement(mdsd_omi_query_element) XmlUtil.addElement(xml=self._mdsd_config_xml_tree, path='Events/OMI', el=mdsd_omi_query_element, addOnlyOnce=True)
def createPerfSettngs(tree,perfs,forAI=False): if not perfs: return for perf in perfs: perfElement = XmlUtil.createElement(perfSchema) perfElement.set('cqlQuery',perf['query']) perfElement.set('eventName',perf['table']) namespace="root/scx" if perf.has_key('namespace'): namespace=perf['namespace'] perfElement.set('omiNamespace',namespace) if forAI: AIUtil.updateOMIQueryElement(perfElement) XmlUtil.addElement(tree,'Events/OMI',perfElement,["omitag","perf"])
def createPerfSettngs(tree, perfs, forAI=False): if not perfs: return for perf in perfs: perfElement = XmlUtil.createElement(perfSchema) perfElement.set("cqlQuery", perf["query"]) perfElement.set("eventName", perf["table"]) namespace = "root/scx" if perf.has_key("namespace"): namespace = perf["namespace"] perfElement.set("omiNamespace", namespace) if forAI: AIUtil.updateOMIQueryElement(perfElement) XmlUtil.addElement(tree, "Events/OMI", perfElement, ["omitag", "perf"])