Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Dampen Script Execution

You can 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.

You can configure the dampen and dampen-options statements at the hierarchy level for the type of script you want to dampen. You can apply dampening to specific scripts or all scripts of a given type. To dampen a script, you configure the dampen statement. To modify the behavior of the script dampening feature, you can configure the following dampening options.

  • cpu-factor—Initiate script dampening when CPU use exceeds the specified value.

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

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

If you configure the dampen statement but you do not configure dampen-options values, the default values are used. If you configure the dampen-options statements at both a global hierarchy level for a given script type as well as for a specific script of that type, the individual script configuration takes precedence.

The script dampening feature does not work for certain CPU-intensive RPCs, including the following:

  • The cscript process might consume numerous CPU cycles for the get-configuration RPC, which involves parsing the XML configuration returned by the mgd process. Since a single line in the script triggers the processing, the device cannot dampen the operation.

  • Executing the show snmp mib walk command might cause the software process to consume numerous CPU cycles. This operation is outside the control of the cscript process and up to the software process to optimize.

To enable script dampening:

  1. Configure the dampen statement at the hierarchy level for the type of scripts you want to dampen. You can apply dampening to specific scripts or all scripts of a given type, depending on the script type.
    • To dampen all event scripts or individual event scripts, configure the dampen statement at the appropriate event script hierarchy level.

    • To dampen all op scripts or individual op scripts, configure the dampen statement at the appropriate op script hierarchy level.

      Note:

      The device only enforces script dampening for local op scripts. If you use the op url command to execute an op script from a remote location, the device does not dampen the script.

    • To dampen all commit scripts, configure the dampen statement at the [edit system scripts commit] hierarchy level. You cannot dampen individual commit scripts due to 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 dampen-options statements. You can configure the dampen-options statements at the same hierarchy levels where you configure the dampen statement.
  3. (Optional) On devices running Junos OS, configure the traceoptions statement to help debug script dampening issues.
    • 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:

    Junos OS Evolved captures trace data for all applications by default and collects the data for all script types in trace files that correspond to the cscript application. To view the trace data, issue the show trace application cscript command.