I'm trying to retrieve the local state of the dhcp server using the above module.
however, I can't get it to work using he below code
As you can see, I've tried various methods.#! /usr/bin/perl use Net::ISC::DHCPd::OMAPI; my $omapi = Net::ISC::DHCPd::OMAPI->new( key => 'omkey ' . 'xxxxxx +' ); $omapi->connect or die "Could not connect to server: ".$omapi->err +str."\n"; # as per cpan page # my $failover = $omapi->new_object("failover",(name => 'st1_dhcpb' +)); # omapi cpan page # my $failover = $omapi->new_object(failover=>(name => 'st1_dhcpb', +)); # as per POD # my %failover_hash = ( 'name' => 'st1_dhcpb'); # my $failover = $omapi->new_object("failover" => %failover_hash); # as per github example my $failover = $omapi->new_object('failover') or die "Could not create failover: ".$omapi->errstr." +\n"; $failover->name('st1_dhcpb'); # Try to get info (equiv to cli 'open' cmd) $failover->read or die "Could not read failover: ".$omapi->errstr +."\n";
Setting debug on (DHCP_OMAPI_DEBUG=1) at the shell level gives
Using omshell interactively$ port 7911 $ server 127.0.0.1 $ key omkey xxxxxx $ connect obj: <null> $ new failover obj: failover $ open can't open object: not found obj: failover $ close obj: <null> Could not read failover:
works fine as you can see.omshell > server localhost > port 7911 > key omkey "xxxxxx" > connect obj: <null> > new failover-state obj: failover-state > set name = "st1_dhcpb" obj: failover-state name = "st1_dhcpb" > open obj: failover-state name = "st1_dhcpb" partner-address = 00:00:71:02:00:00:00:00 . . . partner-state = 00:00:00:02 local-state = 00:00:00:02 .
Cheers
Chris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |