Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

How to set Default Node Monitor - Python f5-SDK

I am trying to set the default node monitor using the F5-SDK.

Here's the code I've tried

from f5.bigip import ManagementRoot
mgmt = ManagementRoot('ip address', 'user', 'password')
mgmt.tm.ltm.defaut_node_monitor.update(rule='/Common/gateway_icmp')

When navigating the API in a browser I see the default-node-monitor is a resource, the update method should work according to the SDK documentation.

https://localhost/mgmt/tm/ltm/default-node-monitor

{
    kind: "tm:ltm:default-node-monitor:default-node-monitorstate",
    selfLink: "https://localhost/mgmt/tm/ltm/default-node-monitor?ver=12.1.2"
}

If I change the default node monitor in the config utility and navigate the API, I notice the rule attribute for the default-node-monitor is changed

{
    kind: "tm:ltm:default-node-monitor:default-node-monitorstate",
    selfLink: "https://localhost/mgmt/tm/ltm/default-node-monitor?ver=12.1.2",
    rule: "/Common/gateway_icmp "
}
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

the default node monitor is not an endpoint in the sdk currently, so that won't work. When we add it, the proper syntax would be:

dnodemon = mgmt.tm.ltm.default_node_monitor.load()
dnodemon.rule = '/Common/gateway_icmp'
dnodemon.update()

I added issue 1142 to the github repository, I'll work on it when I get a chance.

0
Comments on this Answer
Comment made 05-Jun-2017 by Jason Rahm

I haven't added test cases and we won't be able to add to the current stable branch until we clean up some failing tests, but this is functional for me on my fork. Use the feature.default_node_monitor branch to test.

>>> b = ManagementRoot('ltm3.test.local', 'admin', 'admin')
>>> dmon = b.tm.ltm.default_node_monitor.load()
>>> from pprint import pprint as pp
>>> pp(dmon.raw)
{'_meta_data': {'allowed_commands': [],
                'bigip': <f5.bigip.ManagementRoot object at 0x10ec65e50>,
                'container': <f5.bigip.tm.ltm.Ltm object at 0x10fdc9f50>,
                'exclusive_attributes': [],
                'icontrol_version': '',
                'icr_session': <icontrol.session.iControlRESTSession object at 0x10ec65fd0>,
                'minimum_additional_parameters': set([]),
                'minimum_version': '11.5.0',
                'object_has_stats': True,
                'required_command_parameters': set([]),
                'required_json_kind': 'tm:ltm:default-node-monitor:default-node-monitorstate',
                'required_load_parameters': set([]),
                'uri': 'https://ltm3.test.local:443/mgmt/tm/ltm/default-node-monitor/'},
 u'kind': u'tm:ltm:default-node-monitor:default-node-monitorstate',
 u'rule': u'/Common/icmp ',
 u'selfLink': u'https://localhost/mgmt/tm/ltm/default-node-monitor?ver=12.1.0'}
0