Infoblox::Grid::Member::Capture::Control - Traffic capture control object
You can control traffic capture for a grid member via the settings in this object.
my $control = Infoblox::Grid::Member::Capture::Control->new( action => "START" | "STOP", # Required interface => "ALL" | "HA" | "LAN1" | "LAN2" | "MGMT",# Required seconds_to_run => $num, # Required );
The following functions are available to be applied to a traffic capture control object.
Use this function to control traffic capture for the Grid Member. See Infoblox::Grid::Member->traffic_capture() for parameters and return values. Note that the member object must be retrieved from the appliance in order for the traffic capture method to be available.
This section describes all the methods that you can use to control traffic capture for a grid member.
Use this method to select the traffic capture action.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "START" or "STOP".
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Setting the action $control->action("START");
Use this method to specify the interface on which you capture traffic.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "ALL", "HA", "LAN", "LAN2" or "MGMT".
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Choosing the interface $control->interface("ALL");
Use this method to select the number of seconds for which you want to run the traffic capture.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid value is an integer specifying the number of seconds.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Setting the capture interfal $control->seconds_to_run(5);
The following sample code demonstrates the different functions that can be applied to a capture control object. This sample also includes error handling for the operations.
#Preparation prior to traffic capture object operations
#PROGRAM STARTS: Include all the modules that will be used
use strict; use Infoblox;
#Create a session to the Infoblox appliance my $session = Infoblox::Session->new( master => "192.168.1.2", username => "admin", password => "infoblox" ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Start traffic capture for a member
# Get the grid member object. my $object = $session->get( object => "Infoblox::Grid::Member", name => "infoblox.localdomain", );
unless ($object) { die("get grid member failed: ", $session->status_code() . ":" . $session->status_detail()); } print "grid member get successful\n";
my $capture = Infoblox::Grid::Member::Capture::Control->new( action => 'START', interface => 'ALL', seconds_to_run => 2, ); unless ($object->traffic_capture($capture)) { die("traffic capture failed: ", $session->status_code() . ":" . $session->status_detail()); }
print "traffic capture started\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Grid::Member
Copyright (c) 2017 Infoblox Inc.