Merge "fix mapping to create an alarm on a resource other then host"
This commit is contained in:
commit
3d3ee37a78
22
etc/vitrage/datasources_values/network.interface.yaml
Normal file
22
etc/vitrage/datasources_values/network.interface.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
category: RESOURCE
|
||||||
|
values:
|
||||||
|
- aggregated values:
|
||||||
|
priority: 40
|
||||||
|
original values:
|
||||||
|
- name: DELETED
|
||||||
|
operational_value: DELETED
|
||||||
|
- aggregated values:
|
||||||
|
priority: 30
|
||||||
|
original values:
|
||||||
|
- name: ERROR
|
||||||
|
operational_value: ERROR
|
||||||
|
- aggregated values:
|
||||||
|
priority: 20
|
||||||
|
original values:
|
||||||
|
- name: SUBOPTIMAL
|
||||||
|
operational_value: SUBOPTIMAL
|
||||||
|
- aggregated values:
|
||||||
|
priority: 10
|
||||||
|
original values:
|
||||||
|
- name: available
|
||||||
|
operational_value: OK
|
@ -53,7 +53,7 @@ class TemplateApis(object):
|
|||||||
|
|
||||||
def show_template(self, ctx, template_uuid):
|
def show_template(self, ctx, template_uuid):
|
||||||
|
|
||||||
LOG.debug("Show template with uuid: $s", str(template_uuid))
|
LOG.debug("Show template with uuid: %s", str(template_uuid))
|
||||||
|
|
||||||
template = self.templates[template_uuid]
|
template = self.templates[template_uuid]
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class VitrageNotifier(CollectDPlugin):
|
|||||||
payload = {
|
payload = {
|
||||||
'host': notification.host,
|
'host': notification.host,
|
||||||
'plugin': notification.plugin,
|
'plugin': notification.plugin,
|
||||||
'type': notification.type,
|
'collectd_type': notification.type,
|
||||||
'message': notification.message,
|
'message': notification.message,
|
||||||
'severity': severity,
|
'severity': severity,
|
||||||
'time': notification.time,
|
'time': notification.time,
|
||||||
|
@ -79,8 +79,12 @@ class CollectdDriver(AlarmDriverBase):
|
|||||||
event[DSProps.EVENT_TYPE] = event_type
|
event[DSProps.EVENT_TYPE] = event_type
|
||||||
|
|
||||||
if CollectdDriver.conf_map:
|
if CollectdDriver.conf_map:
|
||||||
collectd_host = event[CProps.HOST]
|
# PLUGIN_INSTANCE is optional
|
||||||
v_resource = CollectdDriver.conf_map[collectd_host]
|
resources = [event[CProps.HOST], event[CProps.PLUGIN],
|
||||||
|
event.get(CProps.PLUGIN_INSTANCE)]
|
||||||
|
resource = '/'.join([resource for resource in resources if
|
||||||
|
resource])
|
||||||
|
v_resource = CollectdDriver.conf_map[resource]
|
||||||
event[CProps.RESOURCE_NAME] = v_resource[CProps.RESOURCE_NAME]
|
event[CProps.RESOURCE_NAME] = v_resource[CProps.RESOURCE_NAME]
|
||||||
event[CProps.RESOURCE_TYPE] = v_resource[CProps.RESOURCE_TYPE]
|
event[CProps.RESOURCE_TYPE] = v_resource[CProps.RESOURCE_TYPE]
|
||||||
|
|
||||||
|
@ -20,4 +20,7 @@ class CollectdProperties(object):
|
|||||||
TIME = 'time'
|
TIME = 'time'
|
||||||
MESSAGE = 'message'
|
MESSAGE = 'message'
|
||||||
HOST = 'host'
|
HOST = 'host'
|
||||||
|
PLUGIN = 'plugin'
|
||||||
|
PLUGIN_INSTANCE = 'plugin_instance'
|
||||||
|
TYPE_INSTANCE = 'type_instance'
|
||||||
ID = 'id'
|
ID = 'id'
|
||||||
|
@ -57,6 +57,7 @@ class CollectdTransformer(AlarmTransformerBase):
|
|||||||
metadata = {
|
metadata = {
|
||||||
VProps.NAME: entity_event[CProps.MESSAGE],
|
VProps.NAME: entity_event[CProps.MESSAGE],
|
||||||
VProps.SEVERITY: entity_event[CProps.SEVERITY],
|
VProps.SEVERITY: entity_event[CProps.SEVERITY],
|
||||||
|
VProps.RAWTEXT: self.generate_raw_text(entity_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
return graph_utils.create_vertex(
|
return graph_utils.create_vertex(
|
||||||
@ -101,3 +102,10 @@ class CollectdTransformer(AlarmTransformerBase):
|
|||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return COLLECTD_DATASOURCE
|
return COLLECTD_DATASOURCE
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def generate_raw_text(entity_event):
|
||||||
|
resources = [entity_event.get(CProps.TYPE_INSTANCE),
|
||||||
|
entity_event[CProps.PLUGIN],
|
||||||
|
entity_event.get(CProps.PLUGIN_INSTANCE)]
|
||||||
|
return '-'.join([resource for resource in resources if resource])
|
||||||
|
Loading…
Reference in New Issue
Block a user