Example: Configuring Limits on Executed Event Policies and Memory Allocation for Scripts
On devices running Junos OS, you can configure the maximum number of event policies that can run concurrently on the system and the maximum amount of memory allocated for the data segment for scripts of a given type. This example configures a limit on the number of event polices that the device can execute concurrently and also configures maximum memory limits for executed commit, event, op, and SNMP scripts.
A device running Junos OS Release 12.3 or later.
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 and SNMP script.
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  hierarchy level:
Configure the maximum number of event policies that can execute concurrently.user@host# set event-options max-policies 12
Configure the maximum memory allocated for the data segment for each executed commit script.user@host# set system scripts commit max-datasize 192m
Configure the maximum memory allocated for the data segment for each executed op script.user@host# set system scripts op max-datasize 100m
Configure the maximum memory allocated for the data segment for each executed SNMP script.user@host# set system scripts snmp max-datasize 100m
Configure the maximum memory allocated for the data segment for each executed event script.user@host# set event-options event-script max-datasize 192m
Commit the configuration.user@host# commit
Confirm that the configuration is working properly.
Verifying the Limit on Concurrently Executing Event Policies
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.
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: EVENTD_POLICY_LIMIT_EXCEEDED: Unable to execute policy 'raise-trap' because current number of policies (12) exceeds system limit (12) [output omitted]