Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

How Event Policies Work

 

An event policy is an if-then-else construct. It defines actions to be executed by the eventd process on receipt of one or more events. You can configure multiple policies to be processed for an event. The policies are executed in the order in which they appear in the configuration. For each policy, you can configure multiple actions. The actions are also executed in the order in which they appear in the configuration.

Note

In Junos OS Evolved, the order policies appear in may not be the order in which they are executed. Therefore, the behavior is changed so that if one policy has the ignore option, none of the policies associated with the event are executed.

Note

In Junos OS, eventd throws commit time warning messages if there are duplicate policies. In Junos OS Evolved, eventd will not throw any warning messages. It will accept the policy on a first-come, first-serve basis.

To view a list of the events that can be referenced in an event policy, issue the help syslog ? command.

user@host> help syslog ?

You can filter the output of a search by using the pipe (|) symbol. The following example lists the filters that can be used with the pipe symbol:

user@host> help syslog | ?

For more information about using the pipe symbol, see the CLI User Guide.

You can also list events as you configure the event policy. To view a partial list of the events that can be referenced in an event policy, issue the set event-options policy policy-name events ? configuration mode command.

Some of the system log messages that you can reference in an event policy are not listed in the output of the set event-options policy policy-name events ? command. For information about referencing these system log messages in your event policies, see Using Nonstandard System Log Messages to Trigger Event Policies.

You can configure an event policy to trigger for a single event or for two or more correlated events. For more information about correlating events, see Using Correlated Events to Trigger an Event Policy

In addition, you can reference internally generated events, which are discussed in Generating Internal Events to Trigger Event Policies.

In response to events, the eventd process can execute the following actions:

  • Ignore the event—Do not generate a system log message for this event and do not process any further policy instructions for this event.

  • Upload a file—Upload a file to a specified destination. You can specify a transfer delay, so that, on receipt of an event, the upload of the file begins after the configured transfer delay. For example, to upload a core file, a transfer delay can ensure that the core file has been completely generated before the upload begins.

  • Execute Junos OS operational mode commands—Execute commands on receipt of an event. The XML or text output of these commands is stored in a file, which is then uploaded to a specified URL. You can include variables in the command that allow data from the triggering event to be automatically included in the command syntax.

  • Execute Junos OS configuration mode commands—Execute commands to modify the configuration on receipt of an event. Starting in Junos OS Release 12.1, you can configure an event policy to modify the configuration using Junos OS configuration mode commands and then commit the updated configuration.

  • Execute Junos OS event scripts—Execute event scripts on receipt of an event. Event scripts are Extensible Stylesheet Language Transformations (XSLT), Stylesheet Language Alternative syntaX (SLAX), or Python scripts that you write to perform any function available through Junos XML or Junos XML protocol remote procedure calls (RPCs). Additionally, you can pass to an event script a set of arguments that you define. A script can build and run an operational mode command, receive the command output, inspect the output, and determine the next appropriate action. This process can be repeated until the source of the problem is determined. The output of the scripts is stored in a file, which is then uploaded to a specified URL. You can include variables in the arguments to the scripts that allow data from the triggering event to be incorporated into the script.

  • Raise an SNMP trap.