Creating a rule based on an external event
An Event object lets you to create rules based on internal and external events conditions. It enables you to respond to events based on defined rules that have been specially tailored for an Event.
The Event Engine feature can be used to react to internal and external events. The following use case is based on an external event that is launched by a powershell.
What will you Learn
How to create and define an Event Definition
How to create and define an Event Rule based on an Event Definition
How to launch an event via a script
Prerequisites
- Good knowledge of how to create AE Objects (Events)
- Good understanding how to create rules
- Knowledge of a powershell
Objective
- To trigger an example event based on an external script launch.
Objects used in this use case
Name | Object Type |
---|---|
Event Rule | Connection |
IA Object | Executable VARA |
Creating the Event Definition
- Using the Add Object option, create an EVENT_DEFINITION variable. In the following example we have called itPS.TEST.EVENT.
-
Open the Event definition sheet. We now need to define our Key Attributes, describe them (optional) and assign a Type to them.
- Attribute Key: Key Value Pair (for example application message, status event, acknowledgment and so on).
- Description: Optional but advisable.
-
Type: You can either select String, Number or Boolean in relation to your Attribute Key.
In our test example we have created 3 Key Attributes Count, Name and Statuswhich can be associated with our rules in the Rule Object.
- Save the event.

Create the Rule Object
-
We want to create a Rule Object that under certain conditions, is triggered by our external event.
We have already created an EVENT_DEFINITION variable that holds our Key Attributes and returns our defined Types. Now we have to associate them by creating a Rule.
Using the Add Object option, create a SIMPLE_RULE Event.
We have named ours PS.EVENT.TRIGGER.EXAMPLE for simplicity.
- Open the Rule Event Object and in the Event Definition box, enter (or use the combo list) to link the Event Rule to the previously created Even Definition. In our example we need to link to PS.TEST.EVENT.
-
Using the Add Row button create a new row. We now need to define the Event Rule Conditions by setting the following:
- We are going to link our Attribute in the condition with a Key Attributedefined in the Event definition. We will use in the Key Attribute Count defined in Event definition and create a new Attribute in the Rule Object called event.Count
- Then we will assign a relevant operator, in our example we would like the event to be greater than ">" something.
- Finally we designate a Value. Our condition is if the event.Count is greater (>) than 3 do something (i.e. execute a script, send a message and so on.
-
In the Action section, we set out the steps to be taken when the condition is met. From the Execute box we select an event to execute specific to our event.
-
Select the Attributes tab in the Rule Event object and select an IA Agent to execute the Rule on then click Save.
-
Finally Click Execute to run the Rule. Our Rule will now be displayed as Active in Executions.
In the Details window of Execution we can also see that no rule has been triggered and therefore the Event count value remains 0.
-
To trigger our rule we've created a powershell script that sends events to the Event Engine.
As a summary the script does the following:
- Uses a cmdlet to send events to the Automic Event Engine.
- Specifies that the user uses a proxy to make the request, ensuring security and network integrity.
- Gets API keys from the Event Engine (needed to make requests). See:API Key Management
-
Sends an event to the API REST point "http://localhost:8090/analytics/api/v1/events"
-
Whenever the script is executed the Rule event increases because our data.count is set to 4. Our condition in the event definition states that anything greater than 3 should create an event.

Useful Links