ON THIS PAGE
Example: Configure Limits on Executed Event Policies and Memory Allocation for Scripts
On Junos devices, 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.
Requirements
A device running Junos OS Release 12.3 or later.
Overview
This example configures the device to limit the number of event policies that can run simultaneously 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.
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 192m set system scripts op max-datasize 100m set system scripts snmp max-datasize 100m set event-options max-policies 12 set event-options event-script max-datasize 192m
Procedure
Step-by-Step Procedure
Configure the maximum number of event policies that can execute concurrently.
[edit] user@host# set event-options max-policies 12
Configure the maximum memory allocated for the data segment for each executed commit script.
[edit] user@host# set system scripts commit max-datasize 192m
Configure the maximum memory allocated for the data segment for each executed op script.
[edit] user@host# set system scripts op max-datasize 100m
Configure the maximum memory allocated for the data segment for each executed SNMP script.
[edit] user@host# set system scripts snmp max-datasize 100m
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
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; } snmp { 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]