Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Configuring Limits on Executed Event Policies and Memory Allocation for Scripts

Overview of Limits on Executed Event Policies and Memory Allocation for Scripts

By default, the maximum number of event policies that can run concurrently in the system is 15, and the maximum amount of memory allocated for the data segment portion of an executed script is half of the total available memory of the system, up to a maximum value of 128 MB. If a script requires more memory during execution than the set maximum limit, the script exits. If the system is running the maximum number of event policies, the system ignores any triggered event policy until such time that another policy finishes. The system logs the EVENTD_POLICY_LIMIT_EXCEEDED message for any triggered event policies that were not executed.

Starting with Junos OS Release 12.3, you can configure limits on the maximum number of concurrently running event policies and the maximum amount of memory allocated for the data segment for scripts of a given type.

Depending on the device and its function in the network, it might be necessary to configure larger or smaller limits on the number of event policies that can execute concurrently and the maximum amount of memory allocated to scripts. You might configure smaller limits on critical devices to ensure that priority processes are not adversely impacted, and that the device can perform all necessary functions in the network. Additionally, during normal device operation, you might want to allocate disproportionate amounts of memory to different script types. For example, a device might have a particular type of script that plays a vital role in its operation and requires a specific amount of memory to ensure proper execution.

To set the maximum number of event policies that can run concurrently on a device, configure the max-policies policies statement at the [edit event-options] hierarchy level. You can configure a maximum of 0 through 20 policies.

[edit]
event-options {max-policies policies;}

To set the maximum memory allocated to the data segment for scripts of a given type, configure the max-datasize size statement under the hierarchy appropriate for that script type, where size is the memory in bytes. To specify the memory in kilobytes, megabytes, or gigabytes, append k, m, or g, respectively, to the size. You can configure the memory in the range from 2,3068,672 bytes (22 MB) through 1,073,741,824 bytes (1 GB).

[edit]
event-options {event-script {max-datasize size;}}
system {scripts {commit {max-datasize size;}op {max-datasize size;}}}

When the max-datasize statement is configured and a script executes, Junos OS sets the maximum memory limit for that script to the configured value irrespective of the total memory available on the system at the time of execution. If the script exceeds the maximum memory limit during execution, it exits gracefully.

Example: Configuring Limits on Executed Event Policies and Memory Allocation for Scripts

This example configures a maximum value for the number of event polices that the device can execute concurrently and a maximum memory limit for executed commit, event, and op scripts.

Requirements

A device running Junos OS Release 12.3 or later.

Overview

This example configures a device running Junos OS to limit the number of event policies that can run simultaneously on that device to a maximum of 12 policies. Additionally, the example configures each script type with a maximum amount of memory that the system can allocate to the data segment portion of a script of that type. The device is configured to allocate 192 MB for each executed commit script and event script and 100 MB for each executed op script.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them in a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level:

set system scripts commit max-datasize 192mset system scripts op max-datasize 100mset event-options max-policies 12set event-options event-script max-datasize 192m

Step-by-Step Procedure

  1. Configure the maximum number of event policies that can execute concurrently.

    [edit]user@host# set event-options max-policies 12
  2. Configure the maximum memory allocated for the data segment for each executed commit script.

    [edit]user@host# set system scripts commit max-datasize 192m
  3. Configure the maximum memory allocated for the data segment for each executed op script.

    [edit]user@host# set system scripts op max-datasize 100m
  4. Configure the maximum memory allocated for the data segment for each executed event script.

    [edit]user@host# set event-options event-script max-datasize 192m
  5. Commit the configuration.

    [edit]user@host# commit

Results

[edit]
event-options {event-script {max-datasize 192m;}max-policies 12;}
system {scripts {commit {max-datasize 192m;}op {max-datasize 100m;}}}

Verification

Confirm that the configuration is working properly.

Verifying the Limit on Concurrently Executing Event Policies

Purpose

If the system is running the maximum number of event policies, the system ignores any triggered event policy until such time that another policy finishes. The system logs the EVENTD_POLICY_LIMIT_EXCEEDED messsage for any triggered event policies that were not executed. By default, system log messages are recorded in the messages log file.

Action

Review the configured log file to verify whether any policies were barred from execution, because the maximum limit was reached. You can narrow the output to include only the relevant error messages by appending | match EVENTD_POLICY_LIMIT_EXCEEDED.

user@R1> show log messages | match EVENTD_POLICY_LIMIT_EXCEEDED
Jun 11 17:02:42  R1 eventd[1177]: EVENTD_POLICY_LIMIT_EXCEEDED: Unable to execute policy 'raise-trap' because current number of policies (12) exceeds system limit (12)
[output omitted]

Published: 2013-07-26

Published: 2013-07-26