1 Reply Latest reply on Sep 21, 2009 11:25 AM by chris.lapoint

    Command script writing output file for each device when run as a scheduled task

    kbenton

      Okay, one more and I will lay off...  :-) 

      There should already be a ticket/request kind of thing for this, since I thought it was a bug at first.  If you run a command script from the GUI you have the option to write the output to a file (or write the regex-filtered output to a file) per device.  When you run the command script as a scheduled job, all options "stick" except the file output.  The other options, such as the filter, are saved in the command script, but the file output option is not.  You can write the entire results of the scheduled job to 1 big file, but the results will not show up as filtered (using the regex filter setting) and parsing out which output belongs to which device can be error-prone.  The identifier of the device shows up as the sysname, or the caption, or the ip, and is not delimited.  In the per-device file output, you can specify the name of the file as a specific known variable, such as the IP, making it easy to match the output to the device.

      Being able to schedule a job to do this would enable you to do some post-processing scripting to cull out and save data pretty easily.  For example, there's already a simple get-serial-number-from-device command script that runs show ver and filters out lines matching "serial".  As it is, this works great for one-offs or running it manually, but if you wanted to automate it and keep an updated list as you add or swap out devices, the lack of file output per device makes this unnecessarily difficult.  Maybe serial numbers aren't the best example of something you want to run as a periodic job, but there are definitely a variety of show command output with more dynamic data that would apply here.

      Thanks!

        • Re: Command script writing output file for each device when run as a scheduled task
          chris.lapoint

          There should already be a ticket/request kind of thing for this, since I thought it was a bug at first.  If you run a command script from the GUI you have the option to write the output to a file (or write the regex-filtered output to a file) per device.  When you run the command script as a scheduled job, all options "stick" except the file output.  The other options, such as the filter, are saved in the command script, but the file output option is not.  You can write the entire results of the scheduled job to 1 big file, but the results will not show up as filtered (using the regex filter setting) and parsing out which output belongs to which device can be error-prone.  The identifier of the device shows up as the sysname, or the caption, or the ip, and is not delimited.  In the per-device file output, you can specify the name of the file as a specific known variable, such as the IP, making it easy to match the output to the device.

          The reason this doesn't work is we do NOT provide the advanced options you see in manual script execution in the Execute Script job.   The loading of the script with 'ADVANCED comments actually just sets those options and those comments are then removed from the script display (see screen shot below).   Unfortunately, these advanced options weren't transferred over when we added the Execute Script job. 

          For internal folks, this is being tracked as #4406.