summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/vesagent
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-05-21 22:22:32 +0800
committerBin Yang <bin.yang@windriver.com>2018-05-21 22:22:32 +0800
commit8b473657d4f7dab69bf523545bd842b4a0dcb447 (patch)
tree1a8dfe152bb9b41347e93277a808337dc6ecc944 /windriver/titanium_cloud/vesagent
parent486a3258a61028e0524a2cc871fb90cf9b0b2891 (diff)
Fix incompatible fields of reported events
specificProblem should match Holmes Rules eventId should be unique for each event Change-Id: I8f523fe3f194257aea556918020900cf717da167 Issue-ID: MULTICLOUD-238 Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/vesagent')
-rw-r--r--windriver/titanium_cloud/vesagent/event_domain/fault_vm.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/windriver/titanium_cloud/vesagent/event_domain/fault_vm.py b/windriver/titanium_cloud/vesagent/event_domain/fault_vm.py
index 00738ced..2f94b5bd 100644
--- a/windriver/titanium_cloud/vesagent/event_domain/fault_vm.py
+++ b/windriver/titanium_cloud/vesagent/event_domain/fault_vm.py
@@ -170,7 +170,7 @@ def processBacklog_fault_vm(vesAgentConfig, vesAgentState, oneBacklog):
last_event = backlogState.get("last_event", None)
logger.debug("last event: %s" % last_event)
- this_event = data2event_fault_vm(oneBacklog, last_event, server_resp)
+ this_event = data2event_fault_vm(vimid, oneBacklog, last_event, server_resp)
if this_event is not None:
logger.debug("this event: %s" % this_event)
@@ -188,7 +188,7 @@ def processBacklog_fault_vm(vesAgentConfig, vesAgentState, oneBacklog):
return
-def data2event_fault_vm(oneBacklog, last_event, vm_data):
+def data2event_fault_vm(vimid, oneBacklog, last_event, vm_data):
VES_EVENT_VERSION = 3.0
VES_EVENT_FAULT_VERSION = 2.0
@@ -207,10 +207,10 @@ def data2event_fault_vm(oneBacklog, last_event, vm_data):
eventSeverity = "CRITICAL"
alarmCondition = "Guest_Os_Failure"
vfStatus = "Active"
- specificProblem = "AlarmOn"
+ specificProblem = "Fault_MultiCloud_VMFailure"
eventType = ''
- reportingEntityId = ''
- reportingEntityName = ''
+ reportingEntityId = vimid
+ reportingEntityName = vimid
sequence = 0
startEpochMicrosec = get_epoch_now_usecond()
@@ -230,15 +230,15 @@ def data2event_fault_vm(oneBacklog, last_event, vm_data):
eventSeverity = "NORMAL"
alarmCondition = "Vm_Restart"
vfStatus = "Active"
- specificProblem = "AlarmOff"
+ specificProblem = "Fault_MultiCloud_VMFailureCleared"
eventType = ''
- reportingEntityId = ''
- reportingEntityName = ''
+ reportingEntityId = vimid
+ reportingEntityName = vimid
sequence = 0
startEpochMicrosec = last_event['event']['commonEventHeader']['startEpochMicrosec']
lastEpochMicrosec = get_epoch_now_usecond()
- eventId = last_event['event']['commonEventHeader']['eventId']
+ eventId = str(uuid.uuid4()) #last_event['event']['commonEventHeader']['eventId']
pass
@@ -266,7 +266,18 @@ def data2event_fault_vm(oneBacklog, last_event, vm_data):
'eventSourceType': 'virtualMachine',
'alarmCondition': alarmCondition,
'specificProblem': specificProblem,
- 'vfStatus': 'Active'
+ 'vfStatus': 'Active',
+ "alarmInterfaceA": "aaaa",
+ "alarmAdditionalInformation": [
+ {
+ "name": "objectType",
+ "value": "VIM"
+ },
+ {
+ "name": "eventTime",
+ "value": str(datetime.datetime.now())
+ }
+ ],
}
}