Removing Monitors from Pools

Hello,

can anybody tell me, if it is possible to remove

a specific monitor from a pool?

The interface “remove_monitor_association” removes

all my monitors.

Thanks in advance

Ian

Looks like you are correct, I don’t see a way to remove a single assocation without removing all of them.

In the mean time, you can use the following logic to emulate this method

1. call get_monitor_associations() to return a list of current assocations.

2. call remove_monitor_association() to remove the associations to the pool.

3. remove the association from the returned list from get_monitor_associations().

4. call set_monitor_association() with the new list.

I look into getting this added in a future release.

-Joe

Thanks Joe,

I’ll try this.

Could you please tell me why I am getting an “500 Internal Server Error” with this code. I think it should be correct.

Thanks in advance

Ian

-----------------------------------

package SAM::Tool::BigIP::POOL::addPoolMonitor;

use strict;

use warnings;

use SAM::Syntax;

use SAM::System;

use SAM::Tool::Status qw(user);

use SOAP::Lite;

use MIME::Base64;

use iControlTypeCast;

my $sHost = shift @_;

my $sPort = shift @_;

my $sUID = shift @_;

my $sPWD = shift @_;

my $sPoolName = shift @_;

my $sMonitor = shift @_;

my $sProtocol = “https”;

SOAP::Transport::HTTP::Client::get_basic_credentials($sUID,$sPWD);

sub SOAP::Transport::HTTP::Client::get_basic_credentials

{

my $uid_ref = shift;

my $pwd_ref = shift;

return “$uid_ref” => “$pwd_ref”;

}

if ( (“80” eq $sPort) or (“8080” eq $sPort) )

{

$sProtocol = “http”;

}

my $PoolCreate = SOAP::Lite

→ uri(‘urn:iControl:LocalLB/Pool’)

→ proxy(“$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi”);

eval { $PoolCreate->transport->http_request->header

(

‘Authorization’ =>

'Basic ’ . MIME::Base64::encode(“$sUID:$sPWD”, ‘’)

); };

$sPoolName = “TestPoool”;

my $attribute = { type => “MONITOR_RULE_TYPE_SINGLE” , quorum => 0, monitor_templates => “testmonitor” };

my $Monitor = { pool_name => $sPoolName , monitor_rule => $attribute };

---------------- idev -------

my $soapResponse = $PoolCreate->set_monitor_association(

SOAP::Data->name( monitor_associations => [$Monitor] )

);

&checkResponse($soapResponse);

}

sub checkResponse()

{

my ($soapResponse) = (@_);

if ( $soapResponse->fault )

{

print $soapResponse->faultcode, " ", $soapResponse->faultstring,

“\n”;

exit();

}

}

The only thing that sticks out is that the monitor_templates member of the MonitorRule structure is an array and you are passing in a single string. Try changing your code to the following

my $attribute = {
    type => "MONITOR_RULE_TYPE_SINGLE" ,
    quorum => 0,
    monitor_templates => ["testmonitor"] };

-Joe

Thanks a lot Joe, you saved my day.

Ian