Forum Discussion
Set existing monitor on existing node in Powershell - F5 Big-IP
I know how to create a new node in Powershell. I've read you cannot apply a health monitor upon creation. So how can I add a health monitor afterwards? The name of the node is "TestNode1" and the health monitor is default http.
Below is what I'm playing with. I think I'm close up until the second argument. No idea what to do there. Thanks for any help!
$ic.LocalLBNodeAddressV2.set_monitor_rule("TestNode1",$ic.LocalLBMonitorRule.monitor_rule("http"))
6 Replies
- cjunior
Nacreous
Hi, have you seen this link?
I am no expert, this is my test and it works for me:
Add-PSSnapIn iControlSnapIn Initialize-F5.iControl -HostName 192.168.1.245 -Credentials (Get-Credential) $MonitorRule = New-Object -TypeName iControl.LocalLBMonitorRule $MonitorRule.type = "MONITOR_RULE_TYPE_SINGLE" $MonitorRule.monitor_templates = @("icmp") (Get-F5.iControl).LocalLBNodeAddressV2.set_monitor_rule(@("10.10.10.10"), @($MonitorRule)) Remove-PSSnapIn iControlSnapIn - thennessey_2290
Nimbostratus
Thanks, I had seen that page but it creates the monitor, it doesn't apply an existing monitor. I will give your script a try. Is there a reason you use arrays (@) in this script? Is it necessary to apply a single monitor to a single node? Thanks for the help.
- cjunior
Nacreous
It sets the icmp monitor as a single monitor to node, it is not creating a new one. My arrays were used just to make it clear that the method signature. Usually, I don't need to monitor the node, I do that in the pool. I hope to have it understood. Regards.
- thennessey_2290
Nimbostratus
I am getting this error. This node does exist in common.
$MonitorRule = New-Object -TypeName iControl.LocalLBMonitorRule $MonitorRule.type = "MONITOR_RULE_TYPE_SINGLE" $MonitorRule.monitor_templates = @("icmp") (Get-F5.iControl).LocalLBNodeAddressV2.set_monitor_rule(@("172.22.130.71"), @($MonitorRule))
Exception calling "set_monitor_rule" with "2" argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/NodeAddressV2::set_monitor_rule() Exception: Common::OperationFailed primary_error_code : 16908342 (0x01020036) secondary_error_code : 0 error_string : 01020036:3: The requested Node (/Common/172.22.130.71) was not found." At line:4 char:79 + (Get-F5.iControl).LocalLBNodeAddressV2.set_monitor_rule(@("172.22.130.71"), @($M ... + ~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SoapHeaderException
- thennessey_2290
Nimbostratus
I used the node's name instead of IP and it worked. Strange. In other cases, doing other operations, I had to use the node's IP. Any ideas why? Thanks for the help with getting this working. Much appreciated.
- spencero_196690
Nimbostratus
See George Watkins answer here for an explanation on the quirk between node ip and node name http://bit.ly/2fWpoog
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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