Description

When event-options is used, we can specify execute-commands to run some show commands.  However, when trying to save the output to a file using "|save", it may not work.

Symptoms

Configuration example:

set event-options policy xyz events rpd_start
set event-options policy xyz then execute-commands commands "show system uptime | save abc"

With the above configuration, we can commit successfully. However, after issuing 'restart routing' to restart rpd, the file abc cannot be created.

Solution

There are two ways to correct this behavior:

  1. The file can be created when the following config is added:

    set event-options policy xyz then execute-commands output-format text

    (Please note that the saved file will be in root directory /, not in the home folder of the current user.)

  2. Delete the save option in CLI command and use the destination config in KB83328 [juniper.net]
    https://supportportal.juniper.net/s/article/Triggering-CLI-commands-with-an-event-options-script

Modification History

Replacing " KB16764 - Triggering CLI commands with an event-options script [juniper.net]." 
With :
KB83328 [juniper.net]
https://supportportal.juniper.net/s/article/Triggering-CLI-commands-with-an-event-options-script