Forum Discussion
Using Powershell to run > (Get-F5.iControl).LocalLBNodeAddressV2.set_monitor_rule Command
The function definition for set_monitor rule is here. It looks like this:
struct LocalLB.MonitorRule {
LocalLB.MonitorRuleType type,
int quorum,
String [] monitor_templates
};
enum LocalLB.MonitorRuleType {
MONITOR_RULE_TYPE_UNDEFINED,
MONITOR_RULE_TYPE_NONE,
MONITOR_RULE_TYPE_SINGLE,
MONITOR_RULE_TYPE_AND_LIST,
MONITOR_RULE_TYPE_M_OF_N
};
LocalLB.NodeAddressV2.set_monitor_rule.ashx(
in String [] nodes,
in LocalLB__MonitorRule [] monitor_rules
);The parameters you pass in depend on the type of monitor you want to create. The types of monitor rules you create are defined in the documentation so I'd read the MonitorTypeRule API documentation and decide if you want a single monitor, a bunch of monitors that all need to succeed (MONITOR_RULE_TYPE_AND_LIST) or at least part of the monitors to succeed (MONITOR_RULE_TYPE_M_OF_N) for the system to mark the node as up.
As for coding, you'll need to allocate the structures with the New-Object cmdlet. Here's a snippet of code that may get you going.
Initialize-F5.iControl -hostname -username -password
$MonitorRule = New-Object -TypeName iControl.LocalLBMonitorRule;
$MonitorRule.type = "MONITOR_RULE_AND_LIST";
$MonitorRule.quorum = 1;
$MonitorRule.MonitorTemplates = @("", "");
(Get-F5.iControl).LocalLBNodeAddressV2.set_monitor_rule(
@(""),
@($MonitorRule)
);Keep in mind that this wasn't tested so hopefully I didn't get any syntax errors in there. Also, you'll need to plug in your specific values for the placeholders.
Hope this helps...
-Joe
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
