Infoblox::IPAM::Statistics - Manages IPAM statistics.
The IPAM statistics object is used to view the IPAM statistics of the network or network container in an Infoblox appliance.
The Infoblox::IPAM::Statistics object does not require manual construction.
This section describes all the methods in an Infoblox::Session that can be applied to a IPAM statistics object.
Use this method to retrieve the existing objects from an Infoblox appliance. See Infoblox::Session->get() for parameters and return values.
Apply the following attributes to get the IPAM statistics:
network - Required. An IPv4 address in dotted decimal notation followed by the network prefix (e.g 1.0.0.0/8). network_view - Optional. The name of the network view in which the network object is located. By default, all network views are searched.
my $ipam_stats = $session->get( object => "Infoblox::IPAM::Statistics", network => "1.0.0.0/8", network_view => "my_network_view");
Use this method to search for an IPAM statistics object from an Infoblox appliance. See Infoblox::Session->search() for parameters and return values.
Apply the following attributes to get the IPAM statistics:
network - Required. An IPv4 address in dotted decimal notation followed by the network prefix (e.g 1.0.0.0/8) (regular expression). network_view - Optional. The name of the network view in which the network object is located. By default, all network views are searched.
my $ipam_stats = $session->search( object => "Infoblox::IPAM::Statistics", network => '1\.0\.0\..*', network_view => "my_network_view");
This section describes all the methods that can be used to retrieve the attribute values of a IPAM statistics object.
Use this method to retrieve the network utilization.
none
The method returns the network utilization in percentage.
#Get utilization my $utilization = $ipam_stats->utilization();
Use this method to retrieve the number of conflicts discovered via network discovery. This method is only valid for a Network object.
none
The method returns the number of discovered conflicts. For a NetworkContainer object, the return value is undefined.
#Get conflict_count my $conflict_count = $ipam_stats->conflict_count();
Use this method to retrieve Microsoft Active Directory users related information. This is a read-only attribute.
None
The valid return value is an Infoblox::Grid::MSServer::AdUser::Data object.
#Get ms_ad_user_data my $ms_ad_user_data = $ipam_stats->ms_ad_user_data();
Use this method to retrieve the number of unmanaged IP addresses as discovered by network discovery. This method is only valid for a Network object.
none
The method returns the number of unmanaged IP addresses. For a NetworkContainer object, the return value is undefined.
#Get unmanaged_count my $unmanaged_count = $ipam_stats->unmanaged_count();
Use this method to retrieve the time that the utilization statistics were updated last. This method is only valid for a Network object.
none
The method returns a timestamp value in the ISO 8601 extended format for date and time (e.g. 2008-10-21T10:56:33Z or 2008-10-21T10:56:33.001Z). For a NetworkContainer object, the return value is undefined.
#Get utilization_update my $utilization_update = $ipam_stats->utilization_update();
The following sample code demonstrates the get and search session methods on an IPAM statistics object. Also, this sample code also includes error handling for the operations.
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
#Preparation prior to getting IPAM statistics
#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";
my $member = Infoblox::DHCP::Member->new( name => "infoblox.localdomain", ipv4addr => "192.168.1.2", );
unless($member) { die("Construct member failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Member object created successfully\n";
#Create a Network View object my $network_view = Infoblox::DHCP::View->new( name => "my_network_view", ); unless($network_view) { die("Construct Network View object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Network View object created successfully\n";
#Add the Network View object into the Infoblox appliance through a session $session->add($network_view) or die("Add Network View object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Network View added successfully\n";
#Create the Network object with this member my $network = Infoblox::DHCP::Network->new( network => "1.0.0.0/255.0.0.0", members => [ $member ], network_view => $network_view, ); unless($network) { die("Construct Network object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Network object created successfully\n";
#Add the Network object into the Infoblox appliance through a session $session->add($network) or die("Add Network object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Network added successfully\n";
#Create the DHCP Range object with this member my $dhcp_range = Infoblox::DHCP::Range->new( network => "1.0.0.0/8", start_addr => "1.0.0.1", end_addr => "1.0.0.10", member => $member, network_view => $network_view, ); unless($dhcp_range) { die("Construct DHCP Range failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "DHCP range object created successfully\n";
$session->add($dhcp_range) or die("Add DHCP range object failed: ", $session->status_code() . ":" . $session->status_detail()); print "DHCP range added successfully\n";
#Create the Fixed Address object my $fixed_address = Infoblox::DHCP::FixedAddr->new( "network" => "1.0.0.0/8", "ipv4addr" => "1.0.0.2", "mac" => "22:22:22:22:22:22", "network_view" => $network_view, ); unless($fixed_address) { die("Construct DHCP Fixed address failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "DHCP Fixed address object created successfully\n";
$session->add($fixed_address) or die("Add DHCP Fixed address object failed: ", $session->status_code() . ":" . $session->status_detail()); print "DHCP Fixed address added successfully\n";
#Get the IPAM statistics
my @result_array = $session->get( object => "Infoblox::IPAM::Statistics", network => "1.0.0.0/8", network_view => "my_network_view");
my $ipam_stats = $result_array[0]; unless ($ipam_stats) { die("Get IPAM statistics failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get IPAM Statistics successful\n";
print "Utilization for '1.0.0.0/8': ", $ipam_stats->utilization(), "\n";
#Search for the IPAM statistics
my @result_array = $session->search( object => "Infoblox::IPAM::Statistics", network => '1\.0\.0\..*', network_view => "my_network_view");
my $ipam_stats = $result_array[0]; unless ($ipam_stats) { die("Get IPAM statistics failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get IPAM Statistics successful\n";
print "Utilization for '1.0.0.0/8': ", $ipam_stats->utilization(), "\n";
#Clean up
# Remove the IPAM Statistics object that was just retrieved $session->remove($ipam_stats);
# Retrieve and remove the Network View object my $network_view = $session->get( object => "Infoblox::DHCP::View", name => "my_network_view", ); unless ($network_view) { die("Get Network View failed: ", $session->status_code() . ":" . $session->status_detail()); } $session->remove($network_view);
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::DHCP::Network,Infoblox::DHCP::View,Infoblox::DHCP::FixedAddr,Infoblox::DHCP::Range,Infoblox::Session->add(),Infoblox::Session->get(), Infoblox::Grid::MSServer::AdUser::Data
Copyright (c) 2017 Infoblox Inc.