Connection to the active server Infoblox

597 Views Asked by At

I am a beginner and I have to take a solution using two Infoblox boxes.

Currently, a server is active (master) and the other is passive. if the first fails, the second takes over. I use Perl API, how do I know when I try to connect to a server, if it is the active server or the passive server?

I would only make the connection to the active server,

I have thought about the method active_position() of Infoblox::Grid::Member but I don't know how to use it.

use strict;
use Infoblox;

my $grid_member = Infoblox::Grid::Member->new(gateway=> "xxx.xxx.xxx.xxx",ipv4addr=> "xxx.xxx.xxx.xxx",mask=> "xxx.xxx.xxx.xxx", name=> "ibiza.mydomain.com");
print  'grid : '. $grid_member . "\n";

my $active_server = $grid_member->active_position();
print  $active_server . "\n";

exit;

And this returns:

grid : Infoblox::Grid::Member=HASH(0xf10ca8)
0

What is this "0"?

1

There are 1 best solutions below

0
On

If your Grid Master is a HA pair then you don't need to worry about which one to connect to. You just connect to the VIP (virtual IP) of the HA pair which will always be the same address.

Example session test code:

#!/usr/bin/perl

use strict;
use Infoblox;

# Create a session to the Infoblox appliance
my $SESSION = Infoblox::Session->new(
    master  => "192.168.1.2",
    username => "admin",
    password => "***"
);

if ($SESSION->status_code()) {
    my $result = $SESSION->status_code();
    my $response = $SESSION->status_detail();
    print "Error: $response ($result)\n";
} else {
    print "Connection established\n";
    print "Server Version: ".$SESSION->server_version()."\n";
}

Check the API docs on your appliance https://appianceip/api/doc there are lots and lots of examples embedded in the API docs.

Steve