Using external events
An event source is a collector of events that you can use to trigger a pattern and consequently perform some tasks. An example of an event source is the built-in vCenter event source. You can also define generic event sources which are collectors for defined events. Once the event source is configured, you can use the REST API to POST an event to the event source. When an event is received, you can use them to trigger patterns to perform tasks.
The following topics are covered:
To create an event source
- From the main menu, click the Administration icon.
The Administration page is displayed. - In the Discovery section, click Event Sources.
- Click Add Event Source.
The Add Event Source page displays. - In the Name field, enter a name for the event source. The name is used as a parameter for posting events.
- In the Description field, enter a description for the event source.
- Select a period for event removal. In practice, use a shorter period for a chatty system, and a longer period for a less chatty system.
- Select Enabled to enable the event source.
- Click Apply to apply the changes.
To edit an event source
- In the Event Source table, perform any of the following steps as required for the specific event source that you want to edit:
- To reset an event count, in the Event Sources row, click Actions > Reset Count.
This resets the count to zero. You might need to perform this step to analyze and determine the number of events that are generated from a source within a set period of time. - To update other parameters for the event source, in the Event Sources row, click Actions > Edit.
The Edit Event Source page is displayed.
- To reset an event count, in the Event Sources row, click Actions > Reset Count.
To post an event to the event source
Use the REST API to POST an event to the event source. You can use the Swagger UI while testing, or a program or script. See REST API for more information.
To post to the event source, you must have the api/event_source
permission. You can use the Event Source template to create a user with this permission.
POST the JSON formatted event to /api/v1.0/events
. For example:
{ "source": "string - name of event source", "type": "string – type of event", "params": {"event_detail": "Some useful info", "event_detail2": "Some more info"} // optional parameters }
The event type is the trigger for the pattern.
Write a pattern that triggers on the event type
Write a pattern that performs the tasks required. Use a triggers block of the following form:
triggers on event := ExternalEvent created where type in [ "EventType1", "OtherEventType", "FurtherEventType" ]; end triggers;
External event considerations
External events are consolidated from a scanner to consolidation appliance. If the event source does not exist on the consolidator, it is created.
If you disable an event source, it cannot receive events from the local appliance, it causes an error. However, if you disable an event source on a consolidation appliance, it can receive events from a scanning appliance.
If you post to a non-existent event source, it causes an error.
For each external event posted, the system creates an ExternalEvent node.
Comments
Log in or register to comment.