Caveat: These practice applies to multicloud-windriver only right now.
Cloud Region Registry (Manually)
By default ESR will trigger this registry process, but in case ESR failed to do so or the previous registration is incomplete for some reasons, users could trigger the registration manually
$ export MC_EP=http://{{multicloud-windriver IP}}:9005/api/multicloud-titanium_cloud/v0/{{vimid}}
e.g. $ export MC_EP=http://172.30.3.37:9005/api/multicloud-titanium_cloud/v0/CloudOwner_RegionOne
$ curl -v -s -H "Content-Type: application/json" -X POST $MC_EP/registry
VESagent provision for a Cloud Region
Assuming:
IP to access multiCloud-windriver: 172.30.3.37
VES endpoint: http://172.30.3.55:8081/eventListener/v5 , user/passwd: admin/admin
DMaaP IP: 172.30.3.70
vimid: CloudOwner_RegionOne
VM names: sample_vm_0 and sample_vm_1
Tenant: sampletenant
VESagent provision sample 1: monitor specific VMs under specific tenant
{"vesagent_config":{"backlogs":[{"source":"sample_vm_0 ","domain":"fault","type":"vm","tenant":"sampletenant"},{"source":"sample_vm_1","domain":"fault","type":"vm","tenant":"sampletenant"}],"poll_interval_default":10,"ves_subscription":{"username":"admin","password":"admin","endpoint":"http://172.30.3.55:8081/eventListener/v5"}}}
VESagent provision sample 2: monitor all VMs under specific tenant (by not specify any source or server_id for a backlog)
{"vesagent_config":{"backlogs":[ {"domain":"fault","type":"vm","tenant":"sampletenant"}],"poll_interval_default":10,"ves_subscription":{"username":"admin","password":"admin","endpoint":"http://172.30.3.55:8081/eventListener/v5"}}}
Provisioning the MultiCloud VESagent
$ export MC_EP=http://{{multicloud-windriver IP}}:9005/api/multicloud-titanium_cloud/v0/{{vimid}}
e.g. $ export MC_EP=http://172.30.3.37:9005/api/multicloud-titanium_cloud/v0/CloudOwner_RegionOne
$ curl -v -s -H "Content-Type: application/json" -d @sample_vesagent_2vms -X POST $MC_EP/vesagent
Query the provision of MultiCloud VESagent
export MC_EP=http://{{multicloud-windriver IP}}:9005/api/multicloud-titanium_cloud/v0/{{vimid}}
e.g. export MC_EP=http://172.30.3.37:9005/api/multicloud-titanium_cloud/v0/CloudOwner_RegionOne
curl -v -s -H "Content-Type: application/json" -X GET $MC_EP/vesagent
Delete the provision of MultiCloud VESagent
export MC_EP=http://{{multicloud-windriver IP}}:9005/api/multicloud-titanium_cloud/v0/{{vimid}}
e.g. export MC_EP=http://172.30.3.37:9005/api/multicloud-titanium_cloud/v0/CloudOwner_RegionOne
curl -v -s -H "Content-Type: application/json" -X DELETE $MC_EP/vesagent
Triggering the fault event:
1, Subscribe DMaaP events:
while :; do curl -H “Content-Type:text/plain” -X GET http://172.30.3.70:3904/events/unauthenticated.SEC_FAULT_OUTPUT/group19/C1?timeout=50000; echo; done;
2, Shut off the sample_vm_0 or sample_vm_1 or both
3, observe the dumped event from subscription in step 1
"{\"event\":{\"commonEventHeader\":{\"startEpochMicrosec\":1526900735217016,\"sourceId\":\"14eac7b8-a7d8-4b53-8547-924cd0a5be4f\",\"eventId\":\"153f3494-1906-421a-8aa9-98ddd399f4c2\",\"reportingEntityId\":\"CloudOwner_RegionOne\",\"internalHeaderFields\":{\"collectorTimeStamp\":\"Mon, 05 21 2018 11:05:36 GMT\"},\"eventType\":\"\",\"priority\":\"High\",\"version\":3,\"reportingEntityName\":\"CloudOwner_RegionOne\",\"sequence\":0,\"domain\":\"fault\",\"lastEpochMicrosec\":1526900735217045,\"eventName\":\"Fault_MultiCloud_VMFailure\",\"sourceName\":\"sample_vm_0\"},\"faultFields\":{\"eventSeverity\":\"CRITICAL\",\"alarmCondition\":\"Guest_Os_Failure\",\"faultFieldsVersion\":2,\"specificProblem\":\"Fault_MultiCloud_VMFailure\",\"alarmInterfaceA\":\"aaaa\",\"alarmAdditionalInformation\":[{\"name\":\"objectType\",\"value\":\"VIM\"},{\"name\":\"eventTime\",\"value\":\"2018-05-21 11:05:35.217154\"}],\"eventSourceType\":\"virtualMachine\",\"vfStatus\":\"Active\"}}}"
Triggering the fault cleared event:
1, Subscribe DMaaP events:
while :; do curl -H “Content-Type:text/plain” -X GET http://172.30.3.70:3904/events/unauthenticated.SEC_FAULT_OUTPUT/group19/C1?timeout=50000; echo; done;
2, Start the the sample_vm_0 or sample_vm_1 or both
3, observe the dumped event from subscription in step 1
"{\"event\":{\"commonEventHeader\":{\"startEpochMicrosec\":1526900735217016,\"sourceId\":\"14eac7b8-a7d8-4b53-8547-924cd0a5be4f\",\"eventId\":\"8119c7ff-193e-4e02-b15d-a4fee21f9d2d\",\"reportingEntityId\":\"CloudOwner_RegionOne\",\"internalHeaderFields\":{\"collectorTimeStamp\":\"Mon, 05 21 2018 11:09:46 GMT\"},\"eventType\":\"\",\"priority\":\"Normal\",\"version\":3,\"reportingEntityName\":\"CloudOwner_RegionOne\",\"sequence\":0,\"domain\":\"fault\",\"lastEpochMicrosec\":1526900985730542,\"eventName\":\"Fault_MultiCloud_VMFailureCleared\",\"sourceName\":\"sample_vm_0\"},\"faultFields\":{\"eventSeverity\":\"NORMAL\",\"alarmCondition\":\"Vm_Restart\",\"faultFieldsVersion\":2,\"specificProblem\":\"Fault_MultiCloud_VMFailureCleared\",\"alarmInterfaceA\":\"aaaa\",\"alarmAdditionalInformation\":[{\"name\":\"objectType\",\"value\":\"VIM\"},{\"name\":\"eventTime\",\"value\":\"2018-05-21 11:09:45.730638\"}],\"eventSourceType\":\"virtualMachine\",\"vfStatus\":\"Active\"}}}"