Forum Discussion

Chris_82142's avatar
Chris_82142
Icon for Nimbostratus rankNimbostratus
Mar 07, 2013

Help needed with monitor associations

Hello all,

 

 

I am trying to use Python to script a way to associate existing custom monitors with certains pools only during certain hours. I am able to use b.LocalLB.PoolMember.get_monitor_association() to see a member's monitor but i'm having trouble with b.LocalLB.PoolMember.set_monitor_association() to associate a monitor with a pool.

 

 

Am I using the right function to accomplish this? Could someone be so kind as to post an example of what would have to be done to make this work?

 

 

Thanks!

 

4 Replies

  • Take a look at the function Associate-MonitorWithPool() on this page:

     

    https://devcentral.f5.com/wiki/iControl.PowerShellAppAutomation.ashx

     

     

    Event though it's powershell, it should still give you a good sense of how to do things.

     

  • Thanks for the reply. I will do some digging and see if I can get this to work. So, it seems that there isn't a way to simply associate an existing monitor to a pool by name? I will have to define the rule type, quaorum etc... every time I change the association?

     

     

    Thanks again for the help!

     

  • That depends on the Member Type definitions as they relate to what you're trying to accomplish...

     

     

    https://devcentral.f5.com/wiki/iControl.LocalLB__PoolMember__MemberMonitorAssociation.ashx
  • Sorry, I don't quite follow. If this monitor already exists and all I want to do is change its association with a pool then why do I have to define all of these options? Aren't these already defined when the monitor was created? I feel like I should be able to just associate it based purely on the health monitor's name and the pool name. If I do a get_monitor_association then it returns the following:

     

     

     

     

    I[[(LocalLB.PoolMember.MemberMonitorAssociation){

     

    member =

     

    (LocalLB.MonitorIPPort){

     

    address_type = "ATYPE_EXPLICIT_ADDRESS_EXPLICIT_PORT"

     

    ipport =

     

    (Common.IPPortDefinition){

     

    address = "1.1.1.1"

     

    port = 80

     

    }

     

    }

     

    monitor_rule =

     

    (LocalLB.MonitorRule){

     

    type = "MONITOR_RULE_TYPE_SINGLE"

     

    quorum = 0

     

    monitor_templates[] =

     

    "HTTP_80",

     

    }

     

    }, (LocalLB.PoolMember.MemberMonitorAssociation){

     

    member =

     

    (LocalLB.MonitorIPPort){

     

    address_type = "ATYPE_EXPLICIT_ADDRESS_EXPLICIT_PORT"

     

    ipport =

     

    (Common.IPPortDefinition){

     

    address = "1.1.1.1"

     

    port = 80

     

    }

     

    }

     

    monitor_rule =

     

    (LocalLB.MonitorRule){

     

    type = "MONITOR_RULE_TYPE_SINGLE"

     

    quorum = 0

     

    monitor_templates[] =

     

    "HTTP_80",

     

    }

     

    }]]

     

     

    Really, all I want to do is add a monitor_template to the rule.

     

     

    Thanks again for the help!