Icontrol:Ruby set_monitor_rule API restriction failure

Hello,

I’m having problems with the NodeAddressV2:set_monitor_rule Ruby API. I’m trying to add a basic monitor rule to a node however, always fail with a restriction error no matter what I set in the “monitor_rule” parameter. Has anyone successfully set a monitor using this API? If so, can you post the code?

Code Snippet:

Add icmp monitor if it doesn’t already exist

unless “{rule[0][‘monitor_templates’]}”.include? ‘/Common/icmp’

bigip[‘LocalLB.NodeAddressV2’].set_monitor_rule([ node_name ], [“monitor_rule” => {“type” => “MONITOR_RULE_TYPE_SINGLE”, “quorum” => 0, “monitor_templates” => “/Common/icmp”}])

puts ‘Added ICMP monitor to "’ + node_name + ‘"…’

end

Failure:

/usr/lib/ruby/1.8/wsdl/xmlSchema/simpleType.rb:66:in `check_restriction’: {urn:iControl}LocalLB.MonitorRuleType: cannot accept ‘’ (XSD::ValueSpaceError)

from /usr/lib/ruby/1.8/wsdl/xmlSchema/simpleType.rb:23:in `check_lexical_format’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:125:in `simpleobj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:118:in `obj2typesoap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:131:in `_obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:210:in `elements2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `each’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `elements2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:167:in `struct2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:134:in `complexobj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:120:in `obj2typesoap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:131:in `_obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:179:in `array2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:178:in `each’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:178:in `array2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:136:in `complexobj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:120:in `obj2typesoap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:131:in `_obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:210:in `elements2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `each’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `elements2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:167:in `struct2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:134:in `complexobj2soap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:120:in `obj2typesoap’

from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:131:in `_obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:48:in `obj2soap’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:371:in `protect_threadvars’

from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:43:in `obj2soap’

from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:394:in `request_rpc_enc’

from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:376:in `request_rpc’

from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:338:in `request_body’

from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:123:in `call’

from /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call’

from (eval):6:in `set_monitor_rule’

from ./f5-node-initiator-v1:105

Thanks in advance.

Br,

Darrell G.

Hi Darrell,

Here is the syntax I used:

irb(main):001:0> bigip = F5::IControl.new("test-ltm-ve-03", "admin", "admin", ["LocalLB.NodeAddressV2"]).get_interfaces
=> {"LocalLB.NodeAddressV2"=>>}

irb(main):002:0> bigip["LocalLB.NodeAddressV2"].set_monitor_rule(["test-ubuntu-lucid-01"], [ { "type" => "MONITOR_RULE_TYPE_SINGLE", "quorum" => 0, "monitor_templates" => [ "icmp" ] } ])
=> nil

That sets the ICMP node-specific monitor for node test-ubuntu-lucid-01. I tested using version 11.0.0.1 of the Ruby iControl library on an LTM running version 11.1.0 build 2027.0 HF2. Hope that helps,

George

Hi George,

Hey! It worked!!

Here’s my updated syntax:

bigip['LocalLB.NodeAddressV2'].set_monitor_rule([ node_name ],  [{"type" => "MONITOR_RULE_TYPE_SINGLE", "quorum" => 0, "monitor_templates" => "/Common/icmp"}])

Thanks for your help!

Darrell G.

No problem. Glad it worked!

-George