- play_arrow Overview
- play_arrow Junos Automation Scripts Overview
- play_arrow Junos XML Management Protocol and Junos XML API Overview
-
- play_arrow Automation Scripting Using XSLT
- play_arrow XSLT Overview
- play_arrow Standard XPath and XSLT Functions Used in Automation Scripts
- play_arrow Standard XSLT Elements and Attributes Used in Automation Scripts
-
- play_arrow Automation Scripting Using SLAX
- play_arrow SLAX Overview
- SLAX Overview
- SLAX Syntax Rules Overview
- SLAX Elements and Element Attributes Overview
- SLAX Elements as Function Arguments
- Understanding SLAX Default Namespaces
- XPath Expressions Overview for SLAX
- SLAX Templates Overview
- SLAX Functions Overview
- SLAX Parameters Overview
- SLAX Variables Overview
- SLAX Statements Overview
- XSLT Elements Without SLAX Equivalents
- SLAX Operators
- play_arrow SLAX Statements
- append
- apply-imports
- apply-templates
- attribute
- attribute-set
- call
- copy-node
- copy-of
- decimal-format
- element
- else
- else if
- expr
- fallback
- for
- for-each
- function
- if
- import
- key
- match
- message
- mode
- mvar
- number
- output-method
- param
- preserve-space
- priority
- processing-instruction
- result
- set
- sort
- strip-space
- template
- terminate
- trace
- uexpr
- use-attribute-sets
- var
- version
- while
- with
- play_arrow The libslax Distribution for Automation Scripting
- libslax Distribution Overview
- libslax Library and Extension Libraries Overview
- Download and Install the libslax Distribution
- libslax Default Extension Libraries: bit, curl, db, os, and xutil
- Understanding the SLAX Processor (slaxproc)
- How to Use the SLAX Processor (slaxproc)
- SLAX Debugger, Profiler, and callflow
-
- play_arrow Automation Scripting Using Python
- play_arrow Python Overview
- Understanding Python Automation Scripts for Junos Devices
- Requirements for Executing Python Automation Scripts on Junos Devices
- Overview of Python Modules on Junos Devices
- How to Use Python Interactive Mode on Devices Running Junos OS
- How to Use the psutil Module to Retrieve Process and System Information on Devices Running Junos OS
- How to Use the Requests Library for Python on Devices Running Junos OS
- IPv6 Support in Python Automation Scripts
- How to Specify the Routing Instance in Python 3 Applications on Devices Running Junos OS Evolved
-
- play_arrow Automation Script Input
- play_arrow Global Parameters in Automation Scripts
-
- play_arrow Extension Functions and Named Templates for Automation Scripts
- play_arrow Extension Functions for Automation Scripting
- play_arrow Extension Functions in the jcs and slax Namespaces
- base64-decode() Function (SLAX)
- base64-encode() Function (SLAX)
- break-lines() Function (SLAX and XSLT)
- close() Function (SLAX and XSLT)
- dampen() Function (Python, SLAX, and XSLT)
- document() Function (SLAX)
- emit_error() Function (Python)
- emit_snmp_attributes Function (Python)
- emit_warning() Function (Python)
- empty() Function (SLAX and XSLT)
- evaluate() Function (SLAX)
- execute() Function (SLAX and XSLT)
- first-of() Function (SLAX and XSLT)
- get-command() Function (SLAX)
- get-hello() Function (SLAX and XSLT)
- get-input() Function (SLAX and XSLT) and get_input() (Python)
- get-protocol() Function (SLAX and XSLT)
- get-secret() Function (SLAX and XSLT) and get_secret() (Python)
- get_snmp_action() Function (Python)
- get_snmp_oid() Function (Python)
- hostname() Function (Python, SLAX, and XSLT)
- invoke() Function (SLAX and XSLT)
- open() Function (SLAX and XSLT)
- output() Function (Python, SLAX, and XSLT)
- parse-ip() Function (SLAX and XSLT) and parse_ip() (Python)
- printf() Function (Python, SLAX, and XSLT)
- progress() Function (Python, SLAX, and XSLT)
- regex() Function (SLAX and XSLT)
- set_routing_instance() Function (Python)
- sleep() Function (SLAX and XSLT)
- split() Function (SLAX and XSLT)
- sysctl() Function (Python, SLAX, and XSLT)
- syslog() Function (Python, SLAX, and XSLT)
- trace() Function (Python, SLAX, and XSLT)
- play_arrow Named Templates for Automation Scripting
- play_arrow Named Templates in the jcs Namespace
-
- play_arrow Manage Automation Scripts
- play_arrow Store and Enable Scripts
- play_arrow Configure a Remote Source for Scripts
- play_arrow Configure the Session Protocol for Scripts
- play_arrow Control Execution of Scripts
- play_arrow Synchronize Scripts Between Routing Engines
- play_arrow Convert Scripts Between SLAX and XSLT
-
- play_arrow Configuration Statements and Operational Commands
Trace Script Processing on Devices Running Junos OS Evolved
When you execute an interactive script, the script can generate output, including warnings and errors, in the CLI or RPC reply. When the system triggers non-interactive scripts, for example, when an event policy triggers an event script, the script does not direct output to the terminal. In either case, you might need more information about the execution of the script. Junos OS Evolved captures trace data for all applications by default. You can view the collected traces for additional script processing information, including the memory and CPU usage, script arguments, script execution, and warnings and errors.
Junos OS Evolved collects trace data from all applications on all nodes on the Routing Engine. Whereas Junos OS logs the trace data for each type of script in separate log files, Junos OS Evolved stores the trace data for all scripts in the same location. The trace log includes data for commit, event, op, and SNMP scripts; YANG action and translation scripts; and Juniper Extension Toolkit scripts.
How to Display Trace Data for Scripts
Junos OS Evolved stores the trace data from all nodes that is collected on the primary
Routing Engine under the /var/log/traces directory. The
cscript
application handles scripts, and the trace data for scripts is
stored under the
node.cscript.sequence-number
subdirectories.
To view trace data for scripts, issue the show trace application cscript
operational mode command.
user@host> show trace application cscript 2021-05-20 09:11:42.239695672 re0:cscript:4176:TRACE_INFO CSCRIPT_RUSAGE_CSCRIPT_RUSAGE_1 msg = "Process's current softlimit [134217728] hardlimit [-1]" 2021-05-20 09:11:42.239773157 re0:cscript:4176:TRACE_INFO CSCRIPT_RUSAGE_CSCRIPT_RUSAGE_1 msg = "Process's limits are already set by parent process" 2021-05-20 09:11:42.239812430 re0:cscript:4176:TRACE_INFO CSCRIPT_EVENTS_CSCRIPT_EVENTS_1 msg = "op script processing begins" 2021-05-20 09:11:42.239855140 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: /usr/libexec/ui/cscript" 2021-05-20 09:11:42.239865140 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -mop" 2021-05-20 09:11:42.239866196 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -p" 2021-05-20 09:11:42.239867156 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: /" 2021-05-20 09:11:42.239868116 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -Q2" 2021-05-20 09:11:42.239869131 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -f" 2021-05-20 09:11:42.239882048 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: hello.py" 2021-05-20 09:11:42.239883202 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -d134217728" 2021-05-20 09:11:42.239884135 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -E" 2021-05-20 09:11:42.239885131 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: user admin logname admin host host tty /dev/pts/0 agent op-script current-directory /var/home/admin pid 32212 ppid 32206" 2021-05-20 09:11:42.239886175 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -u" 2021-05-20 09:11:42.239887176 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: admin" 2021-05-20 09:11:42.239888251 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -U" 2021-05-20 09:11:42.239889287 re0:cscript:4176:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -i9" 2021-05-20 09:11:42.245988806 re0:cscript:4176:TRACE_INFO CSCRIPT_EVENTS_CSCRIPT_EVENTS_1 msg = "running op script 'hello.py'" 2021-05-20 09:11:42.246006519 re0:cscript:4176:TRACE_INFO CSCRIPT_EVENTS_CSCRIPT_EVENTS_1 msg = "opening op script '/var/db/scripts/op/hello.py'" ...
You can include the terse
option to display just the timestamp and
message.
user@host> show trace application cscript terse 2021-05-20 09:11:42.239695672 msg = "Process's current softlimit [134217728] hardlimit [-1]" 2021-05-20 09:11:42.239773157 msg = "Process's limits are already set by parent process" 2021-05-20 09:11:42.239812430 msg = "op script processing begins" ...
You can also refine the traces to display by specifying the trace time elapsed, process ID, and node. For example, the following command shows trace data for a specific process ID.
user@host> show trace application cscript pid 10683 2021-05-24 09:42:09.552687492 re0:cscript:10683:TRACE_INFO CSCRIPT_RUSAGE_CSCRIPT_RUSAGE_1 msg = "Process's current softlimit [134217728] hardlimit [-1]" 2021-05-24 09:42:09.552819712 re0:cscript:10683:TRACE_INFO CSCRIPT_RUSAGE_CSCRIPT_RUSAGE_1 msg = "Process's limits are already set by parent process" 2021-05-24 09:42:09.552897412 re0:cscript:10683:TRACE_INFO CSCRIPT_EVENTS_CSCRIPT_EVENTS_1 msg = "action script processing begins" 2021-05-24 09:42:09.553025992 re0:cscript:10683:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: /usr/libexec/ui/cscript" 2021-05-24 09:42:09.553095062 re0:cscript:10683:TRACE_INFO CSCRIPT_ARGUMENTS_CSCRIPT_ARGUMENTS_1 msg = "arg: -maction" ...
How to Modify Trace Settings for Scripts
Junos OS Evolved traces script processing by default and traces all applications at the
info level for informational messages. You can configure trace settings for specific
applications at the [edit system application]
hierarchy level. For example,
you can specify the trace level of the application on a given node.
To modify script tracing operations, configure the settings under the [edit system
trace application cscript]
hierarchy level. The following example configures the
cscript
application to trace script processing on node re0 at the debug
level:
[edit] user@host# set system trace application cscript node re0 level debug user@host# commit
For more information about configuring trace settings, see trace.