Forum Discussion
[iControl Rest]Is there any way to get the current active device and next active device name of a traffic group
Dear Experts,
I have a requirement to get the current active device and next active device of a particular Traffic Group using iControl RestAPI. Since F5 GUI shows these details in list of Traffic groups page but I don't find the direct/indirect way to achieve this. Can any one please help me here.
Regards, Prakash.K
2 Replies
if you hit: https:///mgmt/tm/cm/device/
You will get a JSON dataset that within it has (for us the pair of F5's) each F5 in the HA, and under each F5 there is a value failoverState
so for us in php reading the variable it's $JSON["items"][0]["failoverState"] and $JSON["items"][1]["failoverState"] for the failover state and $JSON["items"][0]["name"] for the device name.
Hope this helps
- tatmotiv
Cirrostratus
I'm currently running into the same problem. The answer above is not helpful. However, you can get the failover state for each device in each traffic-group by querying /mgmt/tm/cm/traffic-group/stats. Thus, you will get a list of all traffic-group members and their respective state in each traffic-group.
BUT: I'm currently not able to query ONE specific traffic-group. Example: I have a traffic group "TG997-Test1" on two devices. When querying the path mentioned above, I get the following response:
> curl -sk -u admin:xxxxxxxx https://lb1/mgmt/tm/cm/traffic-group/stats | python -mjson.tool { "entries": { ... "https://localhost/mgmt/tm/cm/traffic-group/~Common~TG997-Test1:~Common~lb1/stats": { "nestedStats": { "entries": { "deviceName": { "description": "/Common/lb1" }, "failoverState": { "description": "active" }, "nextActive": { "description": "false" }, "trafficGroup": { "description": "/Common/TG997-Test1" } }, "kind": "tm:cm:traffic-group:traffic-groupstats", "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~TG997-Test1:~Common~lb1/stats?ver=11.6.0" } }, "https://localhost/mgmt/tm/cm/traffic-group/~Common~TG997-Test1:~Common~lb2/stats": { "nestedStats": { "entries": { "deviceName": { "description": "/Common/lb2" }, "failoverState": { "description": "standby" }, "nextActive": { "description": "false" }, "trafficGroup": { "description": "/Common/TG997-Test1" } }, "kind": "tm:cm:traffic-group:traffic-groupstats", "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~TG997-Test1:~Common~lb2/stats?ver=11.6.0" } }, }, ... "kind": "tm:cm:traffic-group:traffic-groupcollectionstats", "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/stats?ver=11.6.0" }I see both members and their states in this traffic-groups (all other traffic-groups are also returned, the response above is shortened). But I can neither get the failover state of the members of one particular traffic group...
> curl -sk -u admin:xxxxxxxx https://lb1/mgmt/tm/cm/traffic-group/~Common~TG997-Test1/stats | python -mjson.tool { "generation": 0, "kind": "tm:cm:traffic-group:traffic-groupstats", "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~TG997-Test1/stats?ver=11.6.0" }(no useful data included)
...nor can I poll one of the entries of the "big list" above directly, although I'm following the exact path as in the respective "selfLink" value:
> curl -sk -u admin:xxxxxxxx https://lb1/mgmt/tm/cm/traffic-group/~Common~TG997-Test1:~Common~lb1/stats | python -mjson.tool { "code": 404, "errorStack": [], "message": "01020036:3: The requested traffic group (/Common/TG997-Test1:/Common/lb1) was not found." }I think the REST API in version 11.6.0 HF6 might not yet be completed at this point. Is there anybody out there who ran into the same issue and found a solutions? Maybe, can anybody test if those queries are working with later versions (12+)? Any hint is welcome. Thanks in advance!
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