Infoblox::Grid::SNMP::Admin - Manages a SNMP Admin object.


NAME

Infoblox::Grid::SNMP::Admin - Manages a SNMP Admin object.


DESCRIPTION

SNMP (Simple Network Management Protocol) is a protocol that administrators use to manage network devices and monitor their processes. An SNMP-managed appliance, such as an Infoblox appliance, has an SNMP agent that collects data and stores them as objects in MIBs (Management Information Bases). You can configure an Infoblox appliance as an SNMP-managed appliance. Infoblox appliances support SNMP versions 1, 2, and 3. You can enter values for sysContact, sysLocation, sysName, sysDescr managed objects in MIB-II, the standard MIB defined in RFC 1213. Once these values are set on the appliance, the administrators can send queries for these values from management systems that are allowed to send queries to the appliance.


CONSTRUCTOR

For SNMP Admin objects used as part of an HA pair

 my $snmp = Infoblox::Grid::SNMP::Admin->new(
     sysContact_node1  => $string,      #Optional / Default is empty
     sysDescr_node1    => $string,      #Optional / Default is empty
     sysLocation_node1 => $string,  #Optional / Default is empty
     sysName_node1     => $string,  #Optional / Default is hostname of appliance
     sysContact_node2  => $string,      #Optional / Default is empty
     sysDescr_node2    => $string,      #Optional / Default is empty
     sysLocation_node2 => $string,  #Optional / Default is empty
     sysName_node2     => $string,  #Optional / Default is hostname of appliance
  );

otherwise

 my $snmp = Infoblox::Grid::SNMP::Admin->new(
     sysContact  => $string,  #Optional / Default is empty
     sysDescr    => $string,  #Optional / Default is empty
     sysLocation => $string,  #Optional / Default is empty
     sysName     => $string,  #Optional / Default is hostname of appliance
  );

When the SNMP Admin object is not used as part of an HA pair, sysContact/sysContact_node1, sysDescr/sysDescr_node1, ... are equivalent. The _node2 fields will be empty.


MODULE METHODS

The following functions are available to apply to an SNMP admin object.

Infoblox::Grid->snmp_admin( )

Use this function to specify an SNMP admin at the grid level. See Infoblox::Grid->snmp_admin() for parameters and return values.

Example
  #Construct an object
   my $snmp = Infoblox::Grid::SNMP::Admin->new(
     sysContact  => "Somebody",
     sysDescr    => "SunOS noc1 5.6 Generic_105181-03 sun4u",
     sysLocation => "Infoblox Headquarter",
     sysName     => "noc1"
  );
  #Configure snmp at grid level
  my $response = $grid->snmp_admin($snmp);

Infoblox::Grid::Member->snmp_admin( )

Use this function to specify an SNMP admin at the member level. See Infoblox::Grid::Member->snmp_admin() for parameters and return values.

Example
 #Construct an object
   my $snmp = Infoblox::Grid::SNMP::Admin->new(
     sysContact_node1  => "Somebody",
     sysDescr_node1    => "SunOS noc1 5.6 Generic_105181-03 sun4u",
     sysLocation_node1 => "Infoblox Headquarter",
     sysName_node1     => "noc1"
 );
 # Configure snmp at member level
 $member->snmp_admin($snmp);


METHODS

This section describes all the methods that you can use to configure and retrieve the attribute values of an SNMP admin object.

sysContact( )

Use this method to set or retrieve the name of the contact person for the Simple Network Management Protocol (SNMP) agent host.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The name of the contact person in string format. The maximum length of the name is 50 characters.

Returns

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.

Example
 #Get sysContact
 my $sysContact = $snmp->sysContact();
 #Modify sysContact
 $snmp->sysContact("Infoblox");

sysContact_node1( )

Use this method to set or retrieve the name of the contact person for the Simple Network Management Protocol (SNMP) agent host on node 1 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The name of the contact person in string format. The maximum length of the name is 50 characters.

Returns

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.

Example
 #Get sysContact_node1
 my $sysContact_node1 = $snmp->sysContact_node1();
 #Modify sysContact_node1
 $snmp->sysContact_node1("Infoblox");

sysContact_node2( )

Use this method to set or retrieve the name of the contact person for the Simple Network Management Protocol (SNMP) agent host on node 2 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The name of the contact person in string format. The maximum length of the name is 50 characters.

Returns

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.

Example
 #Get sysContact_node2
 my $sysContact_node2 = $snmp->sysContact_node2();
 #Modify sysContact_node2
 $snmp->sysContact_node2("Infoblox");

sysDescr( )

Use this method to set or retrieve the name and version ID of the system's hardware type, the software Operational System (OS), and networking software that the appliance is running.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Useful information about the hardware and software described in string format. The maximum length of the sysDescr is 50 characters.

Returns

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.

Example
 #Get sysDescr
 my $sysDescr = $snmp->sysDescr();
 #Modify sysDescr
 $snmp->sysDescr("SunOS noc2 5.6 Generic_105181-03 sun5u");

sysDescr_node1( )

Use this method to set or retrieve the name and version ID of the system's hardware type, the software Operational System (OS), and networking software that the appliance is running on node 1 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Useful information about the hardware and software described in string format. The maximum length of the sysDescr_node1 is 50 characters.

Returns

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.

Example
 #Get sysDescr_node1
 my $sysDescr_node1 = $snmp->sysDescr_node1();
 #Modify sysDescr_node1
 $snmp->sysDescr_node1("SunOS noc2 5.6 Generic_105181-03 sun5u");

sysDescr_node2( )

Use this method to set or retrieve the name and version ID of the system's hardware type, the software Operational System (OS), and networking software that the appliance is running on node 2 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Useful information about the hardware and software described in string format. The maximum length of the sysDescr_node2 is 50 characters.

Returns

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.

Example
 #Get sysDescr_node2
 my $sysDescr_node2 = $snmp->sysDescr_node2();
 #Modify sysDescr_node2
 $snmp->sysDescr_node2("SunOS noc2 5.6 Generic_105181-03 sun5u");

sysLocation( )

Use this method to set or retrieve the physical location of the appliance.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The physical location of the appliance in string format. The maximum length of the sysLocation is 50 characters.

Returns

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.

Example
 #Get sysLocation
 my $sysLocation = $snmp->sysLocation();
 #Modify sysLocation
 $snmp->sysLocation("Infoblox Headquarter5");

sysLocation_node1( )

Use this method to set or retrieve the physical location of the appliance on node 1 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The physical location of the appliance in string format. The maximum length of the sysLocation_node1 is 50 characters.

Returns

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.

Example
 #Get sysLocation_node1
 my $sysLocation_node1 = $snmp->sysLocation_node1();
 #Modify sysLocation_node1
 $snmp->sysLocation_node1("Infoblox Headquarter5");

sysLocation_node2( )

Use this method to set or retrieve the physical location of the appliance on node 2 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The physical location of the appliance in string format. The maximum length of the sysLocation_node2 is 50 characters.

Returns

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.

Example
 #Get sysLocation_node2
 my $sysLocation_node2 = $snmp->sysLocation_node2();
 #Modify sysLocation_node2
 $snmp->sysLocation_node2("Infoblox Headquarter5");

sysName( )

Use this method to set or retrieve the fully qualified domain name (FQDN) of the appliance.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The fully qualified domain name (FQDN) of the appliance in string format. The maximum length of the sysName is 50 characters. The default value of sysName is the hostname of the Infoblox appliance.

Returns

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.

Example
 #Get sysName
 my $sysName = $snmp->sysName();
 #Modify sysName
 $snmp->sysName("Infobloxnoc2");

sysName_node1( )

Use this method to set or retrieve the fully qualified domain name (FQDN) of the appliance on node 1 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The fully qualified domain name (FQDN) of the appliance in string format. The maximum length of the sysName_node1 is 50 characters. The default value of sysName_node1 is the hostname of the Infoblox appliance.

Returns

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.

Example
 #Get sysName_node1
 my $sysName_node1 = $snmp->sysName_node1();
 #Modify sysName_node1
 $snmp->sysName_node1("Infobloxnoc2");

sysName_node2( )

Use this method to set or retrieve the fully qualified domain name (FQDN) of the appliance on node 2 of an HA pair.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

The fully qualified domain name (FQDN) of the appliance in string format. The maximum length of the sysName_node2 is 50 characters. The default value of sysName_node2 is the hostname of the Infoblox appliance.

Returns

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.

Example
 #Get sysName_node2
 my $sysName_node2 = $snmp->sysName_node2();
 #Modify sysName_node2
 $snmp->sysName_node2("Infobloxnoc2");


SAMPLE CODE

The following sample code demonstrates the different functions that can be applied to an object such as add, modify and remove. This sample also includes error handling for the operations.

#Preparation prior to an SNMP admin object insertion

 #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";

#Creating an SNMP admin object

 my $snmp = Infoblox::Grid::SNMP::Admin->new(
     sysContact  => "Somebody",
     sysDescr    => "SunOS noc1 5.6 Generic_105181-03 sun4u",
     sysLocation => "Infoblox Headquarter",
     sysName     => "noc1"
     );
 unless($snmp) {
      die("Construct a SNMP Admin failed: ",
            Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "SNMP Admin object created successfully\n";

#Getting the grid object from the appliance through session

  my @result = $session->get(
     object => "Infoblox::Grid",
     name   => "Infoblox"
     );
 my $grid = $result[0];
 unless ($grid) {
        die("Get Grid object failed: ",
             $session->status_code() . ":" . $session->status_detail());
 }
 print "Get Grid object found at least 1 matching entry\n";
       #Modifying the value of the specified object.
         $grid->snmp_admin($snmp);  #Applying the changes.
         $session->modify($grid);
         print "SNMP Admin modified successfully\n";

#Modify SNMP admin attribute sysName

  #Modify existing attribute sysName
  $snmp->sysName("noc2.infoblox.com");
  #Apply changes to the Grid object.
  $grid->snmp_admin($snmp);
  #Update Grid object through the Infoblox session.
  $session->modify($grid)
             or die("modify Grid object failed: ",
                 $session->status_code() . ":" . $session->status_detail());
        print "Modified SNMP Admin sysName of Grid object successful\n";

#Remove SNMP admin attribute from Grid object

  #Apply changes to the Grid object to Un-def SNMP Admin object.
  $grid->snmp_admin(undef);
  #Update Grid object through the Infoblox session.
  $session->modify($grid)
             or die("Remove SNMP Admin from Grid object failed: ",
                 $session->status_code() . ":" . $session->status_detail());
        print "Removed SNMP Admin from Grid object successful\n";
 ####PROGRAM ENDS####


AUTHOR

Infoblox Inc. http://www.infoblox.com/


SEE ALSO

Infoblox::Session,Infoblox::Session->get(), Infoblox::Session->modify(), Infoblox::Grid


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.