diff options
Diffstat (limited to '3rd_party')
-rw-r--r-- | 3rd_party/collectd-ves-app/ves_app/guest.yaml | 8 | ||||
-rw-r--r-- | 3rd_party/collectd-ves-app/ves_app/host.yaml | 10 | ||||
-rw-r--r-- | 3rd_party/collectd-ves-app/ves_app/normalizer.py | 11 |
3 files changed, 19 insertions, 10 deletions
diff --git a/3rd_party/collectd-ves-app/ves_app/guest.yaml b/3rd_party/collectd-ves-app/ves_app/guest.yaml index 7bb7135d..c26bd08c 100644 --- a/3rd_party/collectd-ves-app/ves_app/guest.yaml +++ b/3rd_party/collectd-ves-app/ves_app/guest.yaml @@ -40,13 +40,13 @@ Host Measurements: !Measurements - plugin - plugin_instance - ITEM-DESC: - name: "{vl.plugin}-{vl.plugin_instance}" + name: !StripExtraDash "{vl.plugin}-{vl.plugin_instance}" arrayOfFields: !ArrayItem - SELECT: plugin: "{vl.plugin}" plugin_instance: "{vl.plugin_instance}" - ITEM-DESC: - name: "{vl.type}-{vl.type_instance}-{vl.ds_name}" + name: !StripExtraDash "{vl.type}-{vl.type_instance}-{vl.ds_name}" value: "{vl.value}" measurementInterval: !Number "{vl.interval}" memoryUsageArray: !ArrayItem @@ -265,14 +265,14 @@ Guest Events: !Events lastEpochMicrosec: !Number "{n.time}" startEpochMicrosec: !Number "{n.time}" faultFields: - alarmInterfaceA: "{n.plugin}-{n.plugin_instance}" + alarmInterfaceA: !StripExtraDash "{n.plugin}-{n.plugin_instance}" alarmCondition: "{n.message}" eventSeverity: !MapValue VALUE: "{n.severity}" TO: *collectdSeverityMapping eventSourceType: guest faultFieldsVersion: 1.1 - specificProblem: "{n.plugin_instance}-{n.type_instance}" + specificProblem: !StripExtraDash "{n.plugin_instance}-{n.type_instance}" vfStatus: Active - CONDITION: plugin: "/^(?!virt).*$/" diff --git a/3rd_party/collectd-ves-app/ves_app/host.yaml b/3rd_party/collectd-ves-app/ves_app/host.yaml index a91574cf..0aa53f4c 100644 --- a/3rd_party/collectd-ves-app/ves_app/host.yaml +++ b/3rd_party/collectd-ves-app/ves_app/host.yaml @@ -39,7 +39,7 @@ Host Measurements: !Measurements plugin_instance: "{vl.plugin_instance}" type: "/^(?!memory|virt_vcpu|disk_octets|disk_ops|if_packets|if_errors|if_octets|if_dropped).*$/" - ITEM-DESC: - name: "{vl.type}-{vl.type_instance}-{vl.ds_name}" + name: !StripExtraDash "{vl.type}-{vl.type_instance}-{vl.ds_name}" value: "{vl.value}" additionalMeasurements: !ArrayItem - SELECT: @@ -48,13 +48,13 @@ Host Measurements: !Measurements - plugin - plugin_instance - ITEM-DESC: - name: "{vl.plugin}-{vl.plugin_instance}" + name: !StripExtraDash "{vl.plugin}-{vl.plugin_instance}" arrayOfFields: !ArrayItem - SELECT: plugin: "{vl.plugin}" plugin_instance: "{vl.plugin_instance}" - ITEM-DESC: - name: "{vl.type}-{vl.type_instance}-{vl.ds_name}" + name: !StripExtraDash "{vl.type}-{vl.type_instance}-{vl.ds_name}" value: "{vl.value}" measurementInterval: !Number "{vl.interval}" memoryUsageArray: !ArrayItem @@ -188,14 +188,14 @@ Virt Events: !Events lastEpochMicrosec: !Number "{n.time}" startEpochMicrosec: !Number "{n.time}" faultFields: &faultFields - alarmInterfaceA: "{n.plugin}-{n.plugin_instance}" + alarmInterfaceA: !StripExtraDash "{n.plugin}-{n.plugin_instance}" alarmCondition: "{n.message}" eventSeverity: !MapValue VALUE: "{n.severity}" TO: *collectdSeverityMapping eventSourceType: hypervisor faultFieldsVersion: 1.1 - specificProblem: "{n.plugin_instance}-{n.type_instance}" + specificProblem: !StripExtraDash "{n.plugin_instance}-{n.type_instance}" vfStatus: Active - CONDITION: plugin: virt diff --git a/3rd_party/collectd-ves-app/ves_app/normalizer.py b/3rd_party/collectd-ves-app/ves_app/normalizer.py index ddaad617..84de5e33 100644 --- a/3rd_party/collectd-ves-app/ves_app/normalizer.py +++ b/3rd_party/collectd-ves-app/ves_app/normalizer.py @@ -288,7 +288,7 @@ class Item(yaml.YAMLObject): def format_node(cls, mapping, metric): if mapping.tag in [ 'tag:yaml.org,2002:str', Bytes2Kibibytes.yaml_tag, - Number.yaml_tag]: + Number.yaml_tag, StripExtraDash.yaml_tag]: return yaml.ScalarNode(mapping.tag, mapping.value.format(**metric)) elif mapping.tag == 'tag:yaml.org,2002:map': values = [] @@ -459,6 +459,15 @@ class Number(yaml.YAMLObject): return float(node.value) +class StripExtraDash(yaml.YAMLObject): + """Class to process StripExtraDash tag""" + yaml_tag = u'!StripExtraDash' + + @classmethod + def from_yaml(cls, loader, node): + return '-'.join([ x for x in node.value.split('-') if len(x) > 0]) + + class MapValue(yaml.YAMLObject): """Class to process MapValue tag""" yaml_tag = u'!MapValue' |