05-13-2009 06:27 AM
Hi All,
I need to generate a set of "show" commands daily for a group of devices, and have the text output for each device stored on a server share. For example switch 1 would have a file called switch1_show, switch 2 would have a file called switch2_show, etc.
I would like to use the Netshow tool provided by LMS 3.1, RME. My plan is to:
1. Generate NetShow jobs (with the cwcli interface) for each device. I would generate one job per device since it would be easier to separate the text output into different files for each device.
2. Use following command to create the text output
cwcli netshow jobresults -u xxx -p xxx -id xxxx -output c:\temp\switch1_show.txt
The "cwcli netshow jobresults" command above works fine in a manual process. It's manual because it requires the job id.
I need to automate this procedure, and my problem is trying to find the job id for step 2. Is there a way that cwcli can automatically obtain the job ID without any user intervention?
Does anyone have any suggestions?
--Max
05-13-2009 08:31 AM
You could use the listjobs command to get a list of jobs. For example:
cwcli netshow listjobs -u xxx -p xxx -status C
Listing all completed jobs.....
Job Id = 1358
Job Owner = admin
Scheduled at = Mar 13 2009 15:34:58
Completed at = Mar 13 2009 15:35:32
Sheduled type = Immediate
Job Run Status = Successful
Job description = Multi-command test
-------------------------------------------------------------
Job Id = 1419
Job Owner = admin
Scheduled at = Apr 08 2009 20:45:51
Completed at = Apr 08 2009 20:46:32
Sheduled type = Immediate
Job Run Status = Successful
Job description = IPC test
-------------------------------------------------------------
Job Id = 1420
Job Owner = admin
Scheduled at = Apr 08 2009 20:47:13
Completed at = Apr 08 2009 20:48:01
Sheduled type = Immediate
Job Run Status = Failed
Job description = IPC Test 2
-------------------------------------------------------------
SUMMARY
========
Successful: listjobs
You could then parse that output in your wrapper script to find the job ID you want.
05-14-2009 04:06 AM
Thanks jclarke,
Yes, I was aware of that command. As you mentioned, it would require that I write a script to search for the job description and assoicate it with the job id. This would take me a while to create since I'm not a scripting expert. It would be nice if Cisco updated the cwcli so that I can send the job output to a file. I'm surprised more users don't ask for this feature.
05-14-2009 09:08 AM
This is the first I've heard of someone wanting to dump all of the Netshow jobs outputs to a file. There would be no other way to do it since there could be multiple jobs in Netshow (even multiple jobs for the same device). However, you could talk to your account team, and have them create a Product Enhancement Request on your behalf.
05-14-2009 09:50 AM
Hi jclarke,
Since the jobs can be created with the cwcli command, it would be nice to have the -output option.
cwcli netshow createjob -u Username -p Password -commandset âCommand Set 1â -output c:\temp\output1.txt
If you don't think it would help other, we don't need to do a product request. I'm now trying to find a way to output the set of show commads via a custom SSH script.
Thanks for your help!
05-14-2009 09:52 AM
Adding such a feature would be useful, but as far as I know, no one has requested it.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide