traffic_capture_to_file.pl - Start a traffic capture on a Grid member and download it to a local file.
The initial template usually just has:
traffic_capture_to_file.pl version 0.0.1
Traffic capture of 60 seconds from Grid member ns2.ad.example.com:
traffic_capture_to_file.pl -s=192.168.1.2 -u=admin -p=infoblox -m=ns2.ad.example.com -l=60
I have not put in extensive argument checking, you should use:
-s=<grid master IP>
-u=<username>
-p=<password>
-m=<member name>
-l=<length of capture in seconds>
The options are as follows
The IP address of the Grid Master.
Valid username on the Grid that has persmission to run a traffic capture.
Password of the user.
Member name (FQDN) where you want to run the traffic capture.
Length of the capture in seconds.
Some debug output of the requests between client and server i.e. the script and the Grid Master.
Print this summary
Displays the complete manpage then exits gracefully.
Connects to the GM and verifies the connection. Starts a traffic capture and then waits for that + 10 seconds. Obtains a URL to download the file and a token to signal to the GM when the download is complete. Downloads the file locally with the same name as the original capture; this includes the member name and a timestamp. Signals to the GM to remove the file.
The script will die on any error.
In the script is a minimum WAPI version. This is set to 2.7, but I also tested this on 2.6.1. YMMV.
I hardcoded a 10 second wait after the traffic capture should have finished before starting the download. It is possible this needs to be increased, perhaps if the captures are very large. I am unsure if the captures are copied to GM after completing or the data is streamed in some way, so I arbitrarily chose a 10 second wait. This could be changed to an option.
REST::Client
None known.
Wow! REST::Client, maybe not the best and the documentation leaves something to be desired.
Jim Mozley ( jmozley@infoblox.com )
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.