Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Dampen Script Execution

The Junos software automation feature enables you to create commit, op, event, and SNMP scripts to automate Junos devices. These scripts can be CPU-intensive, potentially impacting other critical software processes such as the routing protocol process (rpd). You can configure the device to dampen or slow down the execution of SLAX and XSLT commit, op, and event scripts. Although the scripts are processed more slowly, enabling script dampening helps to ensure that the other critical software processes can function normally.

Note:

Script dampening is only supported for SLAX and XSLT scripts. Junos devices do not support script dampening for Python automation scripts.

The script dampening feature does not work for certain CPU-intensive remote procedure calls (RPCs), including the following:

  • Executing the following RPC might cause the software process to consume numerous CPU cycles. This cannot be avoided as it is outside the control of the cscript process and up to the software process to optimize.

  • The cscript process might consume numerous CPU cycles for this particular RPC, as this involves parsing of the XML configuration returned by the management process (mgd). This cannot be avoided since a single line in the script triggers the processing.

To enable script dampening:

  1. Include the dampen statement.

    The dampen statement and the script dampening options configured under the dampen-options statement can be configured at various hierarchy levels, depending on the type of scripts you want to dampen and whether or not you want to apply dampening to specific scripts or all scripts.

    • You can dampen all event scripts by configuring the dampen statement at the [edit event-options event-script] hierarchy level or dampen a specific event script by configuring the dampen statement at the [edit event-options event-script file filename] hierarchy level.

    • You can dampen all op scripts by configuring the dampen statement at the [edit system scripts op] hierarchy level or dampen a specific op script by configuring the dampen statement at the [edit system scripts op file filename] hierarchy level.

      Note:

      Script dampening is only enforced for op scripts that are local to the device. If you execute an op script from a remote location using the op url command, Junos OS does not dampen the script.

    • You can dampen all commit scripts by configuring the dampen statement at the [edit system scripts commit] hierarchy level. You cannot dampen a specific commit script. This is a limitation of the cscript process which runs a single commit script at a time.

  2. (Optional) Modify the behavior of the script dampening feature by configuring the following dampening options:
    • cpu-factor—Script dampening is initiated when CPU use exceeds the value specified using this statement.

    • line-interval—Specifies the number of lines of script to execute before pausing.

    • time-interval—Specifies the time that script execution is paused.

    To configure the script dampening options, configure the following statements. If you configure the dampen statement and do not configure values for these statements, the defaults are used. You can configure the dampen-options statements at all of the hierarchy levels at which you can configure the dampen statement.

    If you configure the dampen-options statements at both a global hierarchy level (for example, at the [edit event-options event-script] hierarchy level) or for a specific script (for example, at the [edit event-options event-script file filename] hierarchy level), the file hierarchy level configuration takes precedence.

  3. (Optional) On devices running Junos OS, configure the traceoptions statement to help debug issues related to the script dampening feature.
    • For commit scripts, include the events flag in the traceoptions statement configuration.

    • For event scripts, include the events flag in the traceoptions statement configuration.

    • For op scripts, include the events flag in the traceoptions statement configuration.

    The following traceoptions file output is an example of the trace message logged when a script is paused by the script dampening feature: