This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Save script output

Is there a way to run an arbitrary CLI command, cook the output, and save the result to a table so that it can be included in a report? For example, I might want to run the verify /md5 flash:file.txt, then take just the result and save it somewhere.

The raw output might look like:

.Done!

verify /md5 (flash:/file.txt) = 0a03116ed53e744daa4e412cd343808b

but we would only save 0a03116ed53e744daa4e412cd343808b

Thanks

  • I figured out how to use a Configuration Change Template to run a command(s) against many devices. Then I have an external script that looks through the transfer queue log table for a keyword I put in the CLI, perform the desired text manipulation, look if the current value of a custom property matches the value just found, and uses SWIS to update the custom property for that node if they don't match. So far so good. In my proof of concept script I'm grabbing the configuration register and saving it to a custom property, but the same technique should work for lots of other things.

    Now I'm trying to see if Configuration Change Templates can be set to run on a schedule, but it doesn't look like that's an option. If they can, I can set my external script to run from a Windows Schedule Task slightly afterwards. Assuming there's no option for scheduling with Configuration Change Templates, I do see the Example Execute Command Script job. I tried it out, but the options are slightly different. I think I can parse the log file, or maybe the JobLog value in NCM_NCMJobs for the same information. In the WUI I see something about logs that are too big for the webpage. Would it be better to have the job save to a file instead of using the database to avoid any such limitation?

  • I got it working with an NCM Job. I scheduled the job to run and save the results to a text file. Then I have an external script that parses the file to get the node's IP address and the command output, do a SQL query to get the NodeID from the IP address, then use SWIS to update the node's custom property after performing any desired text manipulation on the command output.