Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Executing Scripts on Devices

    You can use Junos Space Network Management Platform to trigger the execution of op scripts on one or more devices simultaneously. Commit and event scripts are automatically activated after they are enabled. Commit scripts are triggered every time a commit is called on the device and event scripts are triggered every time an event occurs on the device or at a specific time, if a time is specified.

    Caution: If the filename of the selected script matches that of any script present on the device, then the script on the device is executed regardless of its contents.

    To execute an op script on devices:

    1. On the Junos Space Platform UI, select Images and Scripts > Scripts.

      The Scripts page appears, displaying the scripts that you imported into Junos Space Platform.

    2. Select the op script that you want to execute on a device.
    3. Select Execute Script on Devices from the Actions menu. This option is enabled only when the script is staged.

      The Execute Script on Device(s) page appears. If the selected script is already disabled on the devices, then Junos Space displays the following message instead of the Execute Scripts on Device(s) page:
      Disabled script cannot be executed.

      By default, the Execute Script on Device(s) page lists the devices on which the latest version of the script is staged. If no devices are listed, it means that the latest version of the script is not staged yet. If you have staged the previous versions of the script, select one of the staged versions from the Version list. The page displays the list of devices on which this version of the script is staged.

      Note: To find out which version of the script is staged, select the script and click View in the Associations column on the Scripts page. The Staged Version column displays the version of the script that is staged.

    4. Select the devices on which you want the script to be executed, by using one of the following selection modes—manually, on the basis of tags, or by using a comma-separated values (CSV) file. These options are mutually exclusive. If you select one, the others are disabled.

      Note: By default, the Select Device Manually option is selected and the list of devices that can be selected is displayed.

      • To select devices manually:
        • Click the Select Device Manually option and select the device(s) that have the script staged on them. The Select Devices status bar shows the total number of devices that you selected; the status bar is dynamically updated as you select the devices.
        • To select all the devices, select the check box in the column header next to the Host Name column.
      • To select devices on the basis of tags:
        1. Click the Select by Tags option. The Select by tags list is activated.
        2. Click the arrow on the Select by Tags list. A list of tags defined on devices in Junos Space Platform appear, displaying two categories of tags—Public and Private.

          Note: If no tags are displayed, then it means that none of the devices is associated with any tag. You need to tag the devices on the Device Management page before you can use the Select by Tags option.

        3. To select tags, perform one of the following actions:
          • Select the check boxes next to the tag names to select the desired tags and click OK.
          • To search for a specific tag, enter the first few letters of the tag name in the Select by Tags field to the left of the OK button. If a match is found, a suggestion is made. Select the suggested match and click OK.

          As you select the tags, the total number of devices associated with the selected tags appears just above the device display table. For example, if there are six devices associated with the selected tags, then 6 items selected is displayed.

          The selected tags appear next to the Tags Selected label. An [X] icon appears after each tag name. You can click the [X] icon to clear any tag from the list. The device count decrements accordingly.

          The device display table displays the devices associated with the selected tags.

      • To select devices by using a CSV file:
        1. Select the Select by CSV option.
        2. Click Browse to navigate to the file location on your computer and select the CSV file containing the list of devices on which you want to execute the script.

          Tip: For a sample CSV file, click the Sample CSV link. You are prompted to save the file. Save the file to your computer and open it by using an application such as Microsoft Excel.

        3. Click Upload to upload the CSV file.
    5. (Optional) To specify values for the parameters for script execution, click Value.
    6. (Optional) To schedule a time to execute the script, select the Schedule at a later time check box and use the calendar icon and drop-down list respectively to specify the date and time when you want the script to be executed.
    7. Click Execute.

      The selected scripts are executed on the devices, and the Execute Script Information dialog box displays a link to the job ID.

    8. Perform one of the following actions on the Execute Scripts Information dialog box:
      • To verify the status of this job, click the job ID on this dialog box.

        The Job Management page appears. Double-click the job pertaining to the script execution operation to view the Script Management Job status page. Click the View Results link in the Description column to view the results of script execution. The Script Execution Job Results page allows you to read and understand the script execution results. Click the [X] icon to close this page.

      • Click OK to go back to the Scripts page.

    You can export details about the execution of a script as a comma-separated values (CSV) file to your local file system:

    1. On the Junos Space Platform UI, select Jobs > Job Management.

      The Job Management page appears.

    2. Double-click the job pertaining to the script execution operation.

      The Script Management Job Status page appears.

    3. Click Export as CSV.

      You are prompted to save the file.

    4. Click OK on the File Save dialog box to save the file to your local file system.
    5. After you save the file, to return to the Job Management page, click OK on the Exporting Script Job dialog box.

      Use an application such as Microsoft Excel to open the file from your local system. Typically, you can view the script output in the Description column of this file.

    You can view details of script execution tasks from the Device Management page (Devices > Device Management) by selecting one or more devices and selecting View Script Executions from the shortcut menu (Devices > Device Management > Select a device > Device Inventory). This option displays only the results of op scripts executed on the device and not the commit or event scripts.

    Modified: 2016-03-07