CloudForms Alerts and Management Events

  • by

CloudForms has the capability to trigger a management event if the driving event is met. So for example if a vmware vm gets a reset you can execute a custom event under System – Events – CustomEvents – Management:

If you want to execute a Management event you will need to copy the Management class into your datastore and point the instance ( in my case walk_objects) via relationship to the instance (object_walker)  you want to execute

For this alert to be triggered you will need an alert profile and assign it to the provider you would like to be monitored.

Once the Alert Profile is active you can check /var/www/miq/vmdb/log/automation.log and watch the alert being triggered.

[----] I, [2017-06-30T14:36:36.666253 #3258:12f3130]  INFO -- : MiqAeEvent.build_evm_event >> event=<"vm_reset"> inputs=<{:ext_management_systems=>#<ManageIQ::Providers::Vmware::InfraManager id: 99000000000012, name: "VMware", created_on: "2017-05-30 15:03:48", updated_on: "2017-06-30 18:36:32", guid: "2eff6b26-4549-11e7-93fb-001a4a160155", zone_id: 99000000000001, type: "ManageIQ::Providers::Vmware::InfraManager", api_version: "6.0", uid_ems: "0302ea13-8681-4b48-9609-b4aea788ca63", host_default_vnc_port_start: nil, host_default_vnc_port_end: nil, provider_region: nil, last_refresh_error: nil, last_refresh_date: "2017-06-30 18:36:32", provider_id: nil, realm: nil, tenant_id: 99000000000001, project: nil, parent_ems_id: nil, subscription: nil, last_metrics_error: nil, last_metrics_update_date: nil, last_metrics_success_date: nil, tenant_mapping_enabled: nil>, :ems_event=>#<EmsEvent id: 99000000032991, event_type: "ResetVM_Task_Complete", message: "ResetVM_Task Completed", timestamp: "2017-06-30 18:39:30", host_name: "10.9.62.6", host_id: 99000000000010, vm_name: "geert-01", vm_location: "[Shared-NFS] geert-01/geert-01.vmx", vm_or_template_id: 99000000000968, dest_host_name: nil, dest_host_id: nil, dest_vm_name: nil, dest_vm_location: nil, dest_vm_or_template_id: nil, source: "EVM", chain_id: 3521042, ems_id: 99000000000012, is_task: true, full_data: nil, created_on: "2017-06-30 18:36:32", username: "VSPHERE.LOCAL\\Administrator", ems_cluster_id: nil, ems_cluster_name: nil, ems_cluster_uid: nil, dest_ems_cluster_id: nil, dest_ems_cluster_name: nil, dest_ems_cluster_uid: nil, availability_zone_id: nil, container_node_id: nil, container_node_name: nil, container_group_id: nil, container_group_name: nil, container_namespace: nil, type: "EmsEvent", target_type: nil, target_id: nil, container_id: nil, container_name: nil, container_replicator_id: nil, container_replicator_name: nil, middleware_server_id: nil, middleware_server_name: nil, middleware_deployment_id: nil, middleware_deployment_name: nil, generating_ems_id: nil>, "MiqEvent::miq_event"=>99000000032992, :miq_event_id=>99000000032992, "EventStream::event_stream"=>99000000032992, :event_stream_id=>99000000032992}>
[----] I, [2017-06-30T14:36:36.691414 #3258:12f3130]  INFO -- : Followed  Relationship [miqaedb:/System/event_handlers/event_action_policy?target=src_vm&policy_event=vm_reset&param=#create]
[----] I, [2017-06-30T14:36:36.691980 #3258:12f3130]  INFO -- : Followed  Relationship [miqaedb:/System/Event/EmsEvent/EVM/ResetVM_Task_Complete#create]
[----] I, [2017-06-30T14:36:40.434617 #28263:12f3130]  INFO -- : Instantiating [/System/Process/Event?EventStream%3A%3Aevent_stream=99000000032992&ExtManagementSystem%3A%3Aext_management_system=99000000000012&MiqEvent%3A%3Amiq_event=99000000032992&MiqServer%3A%3Amiq_server=99000000000001&User%3A%3Auser=99000000000001&VmOrTemplate%3A%3Avm=99000000000968&event_stream_id=99000000032992&event_type=vm_reset&ext_management_system_id=99000000000012&miq_event_id=99000000032992&object_name=Event&vmdb_object_type=vm]
[----] I, [2017-06-30T14:36:40.481990 #28263:12f3130]  INFO -- : Updated namespace [/System/Process/Event?EventStream%3A%3Aevent_stream=99000000032992&ExtManagementSystem%3A%3Aext_management_system=99000000000012&MiqEvent%3A%3Amiq_event=99000000032992&MiqServer%3A%3Amiq_server=99000000000001&User%3A%3Auser=99000000000001&VmOrTemplate%3A%3Avm=99000000000968&event_stream_id=99000000032992&event_type=vm_reset&ext_management_system_id=99000000000012&miq_event_id=99000000032992&object_name=Event&vmdb_object_type=vm  ManageIQ/System]
[----] I, [2017-06-30T14:36:40.555290 #28263:12f3130]  INFO -- : Following Relationship [miqaedb:/System/Event/MiqEvent/POLICY/vm_reset#create]
[----] I, [2017-06-30T14:36:40.606981 #28263:12f3130]  INFO -- : Updated namespace [miqaedb:/System/Event/MiqEvent/POLICY/vm_reset#create  ManageIQ/System/Event/MiqEvent]
[----] I, [2017-06-30T14:36:40.621193 #28263:12f3130]  INFO -- : Instance [/ManageIQ/System/Event/MiqEvent/POLICY/vm_reset] not found in MiqAeDatastore - trying [.missing]
[----] I, [2017-06-30T14:36:40.638063 #28263:12f3130]  INFO -- : Following Relationship [miqaedb:/System/event_handlers/event_enforce_policy#create]
[----] I, [2017-06-30T14:36:40.645288 #28263:12f3130]  INFO -- : Updated namespace [miqaedb:/System/event_handlers/event_enforce_policy#create  ManageIQ/System]
[----] I, [2017-06-30T14:36:40.660103 #28263:12f3130]  INFO -- : Updated namespace [System/event_handlers/event_enforce_policy  ManageIQ/System]
[----] I, [2017-06-30T14:36:40.667034 #28263:12f3130]  INFO -- : Invoking [builtin] method [/ManageIQ/System/event_handlers/event_enforce_policy] with inputs [{}]
[----] I, [2017-06-30T14:36:40.910745 #28263:12f3130]  INFO -- : Followed  Relationship [miqaedb:/System/event_handlers/event_enforce_policy#create]
[----] I, [2017-06-30T14:36:40.911211 #28263:12f3130]  INFO -- : Followed  Relationship [miqaedb:/System/Event/MiqEvent/POLICY/vm_reset#create]
[----] I, [2017-06-30T14:36:52.806925 #57096:12f3130]  INFO -- : MiqAeEvent.build_evm_event >> event=<"walk_objects"> inputs=<{:miq_alert_description=>"testalert", :miq_alert_id=>99000000000026, :alert_guid=>"62334b9c-5db9-11e7-9173-001a4a160155", "EventStream::event_stream"=>99000000032993, :event_stream_id=>99000000032993}>
[----] I, [2017-06-30T14:36:57.889023 #3258:12f3130]  INFO -- : Instantiating [/System/Process/Event?EventStream%3A%3Aevent_stream=99000000032993&MiqServer%3A%3Amiq_server=99000000000001&User%3A%3Auser=99000000000001&VmOrTemplate%3A%3Avm=99000000000968&alert_guid=62334b9c-5db9-11e7-9173-001a4a160155&event_stream_id=99000000032993&event_type=walk_objects&miq_alert_description=testalert&miq_alert_id=99000000000026&object_name=Event&vmdb_object_type=vm]
[----] I, [2017-06-30T14:36:57.942064 #3258:12f3130]  INFO -- : Updated namespace [/System/Process/Event?EventStream%3A%3Aevent_stream=99000000032993&MiqServer%3A%3Amiq_server=99000000000001&User%3A%3Auser=99000000000001&VmOrTemplate%3A%3Avm=99000000000968&alert_guid=62334b9c-5db9-11e7-9173-001a4a160155&event_stream_id=99000000032993&event_type=walk_objects&miq_alert_description=testalert&miq_alert_id=99000000000026&object_name=Event&vmdb_object_type=vm  ManageIQ/System]
[----] I, [2017-06-30T14:36:58.124760 #3258:12f3130]  INFO -- : Following Relationship [miqaedb:/System/Event/CustomEvent/Alert/walk_objects#create]
[----] I, [2017-06-30T14:36:58.165017 #3258:12f3130]  INFO -- : Updated namespace [miqaedb:/System/Event/CustomEvent/Alert/walk_objects#create  customevents/System/Event/CustomEvent]
[----] I, [2017-06-30T14:36:58.221602 #3258:12f3130]  INFO -- : Following Relationship [miqaedb:/discovery/objectwalker/object_walker#create]
[----] I, [2017-06-30T14:36:58.235954 #3258:12f3130]  INFO -- : Updated namespace [miqaedb:/discovery/objectwalker/object_walker#create  Investigative_Debugging/discovery]
[----] I, [2017-06-30T14:36:58.267687 #3258:12f3130]  INFO -- : Updated namespace [discovery/objectwalker/object_walker  Investigative_Debugging/discovery]
[----] I, [2017-06-30T14:36:58.277323 #3258:12f3130]  INFO -- : Invoking [inline] method [/Investigative_Debugging/Discovery/ObjectWalker/object_walker] with inputs [{}]
[----] I, [2017-06-30T14:36:58.283267 #3258:12f3130]  INFO -- : <AEMethod [/Investigative_Debugging/Discovery/ObjectWalker/object_walker]> Starting 
[----] I, [2017-06-30T14:36:59.252160 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:   Object Walker 1.9.3 Starting
[----] I, [2017-06-30T14:36:59.257955 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] --- walk_association_policy details ---
[----] I, [2017-06-30T14:36:59.258626 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] walk_association_policy = whitelist
[----] I, [2017-06-30T14:36:59.259661 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] walk_association_whitelist = {'MiqAeServiceServiceTemplateProvisionTask':['source','destination','miq_request','miq_request_task','miq_request_tasks','service_resource'],'MiqAeServiceServiceTemplateProvisionRequest':['miq_request','miq_request_tasks','requester','resource','source'],'MiqAeServiceServiceTemplate':['service_resources'],'MiqAeServiceServiceResource':['resource','service_template'],'MiqAeServiceMiqProvisionRequest':['miq_request','miq_request_tasks','miq_provisions','requester','resource','source','vm_template'],'MiqAeServiceMiqProvisionRequestTemplate':['miq_request','miq_request_tasks'],'MiqAeServiceManageIQ_Providers_Vmware_InfraManager_Provision':['source','destination','miq_provision_request','miq_request','miq_request_task','vm','vm_template'],'MiqAeServiceManageIQ_Providers_Redhat_InfraManager_Provision':['ALL'],'MiqAeServiceManageIQ_Providers_Amazon_CloudManager_Vm':['availability_zone','cloud_network','cloud_subnet','cloud_subnets'],'MiqAeServiceManageIQ_Providers_Vmware_InfraManager_Vm':['ems_cluster','ems_folder','resource_pool','ext_management_system','storage','service','hardware','operating_system'],'MiqAeServiceManageIQ_Providers_Redhat_InfraManager_Vm':['ems_cluster','resource_pool','ext_management_system','storage','service','hardware'],'MiqAeServiceManageIQ_Providers_Azure_CloudManager_Vm':['availability_zone','cloud_networks','cloud_subnets'],'MiqAeServiceManageIQ_Providers_Google_CloudManager_Vm':['flavor','floating_ip'],'MiqAeServiceManageIQ_Providers_Openstack_CloudManager_Vm':['miq_provision','network_ports','network_routers','operating_system'],'MiqAeServiceHardware':['nics','guest_devices','ports','vm'],'MiqAeServiceUser':['current_group'],'MiqAeServiceGuestDevice':['hardware','lan','network'],'MiqAeServiceManageIQ_Providers_Redhat_InfraManager_Template':['operating_system'],'MiqAeServiceManageIQ_Providers_AnsibleTower_ConfigurationManager_ConfigurationScript':['ALL'],'MiqAeServiceManageIQ_Providers_AnsibleTower_ConfigurationManager_Job':['ALL']}
[----] I, [2017-06-30T14:36:59.260409 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] --- $evm.current_* details ---
[----] I, [2017-06-30T14:36:59.262068 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_namespace = Investigative_Debugging/discovery   (type: String)
[----] I, [2017-06-30T14:36:59.263590 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_class = objectwalker   (type: String)
[----] I, [2017-06-30T14:36:59.265195 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_instance = object_walker   (type: String)
[----] I, [2017-06-30T14:36:59.266635 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_method = object_walker   (type: String)
[----] I, [2017-06-30T14:36:59.268156 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_message = create   (type: String)
[----] I, [2017-06-30T14:36:59.270174 #3258:13c0478]  INFO -- : <AEMethod object_walker> object_walker#2CDAA63F:[0] $evm.current_object = /Investigative_Debugging/discovery/objectwalker/object_walker   (type: DR

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.