Forum Discussion

iAzhar's avatar
iAzhar
Icon for Nimbostratus rankNimbostratus
May 20, 2021
Solved

REST API Query

I would like to get the status of the pool and web servers [online/offline] via rest API. I’ve gone through the API documentation but couldn’t figure out what should be my API call.

 

Can someone here please help?

  • Hi,

     

    Have you seen this one? https://devcentral.f5.com/s/question/0D51T00006i7Yj4/icontrol-rest-getting-pool-member-status

     

    Basically, this should be your curl request (change the name of the pool/IP and add user/pass):

     

    curl --request GET --url 'https://192.168.10.31/mgmt/tm/ltm/pool/~Common~wiki-pool/members/stats'

     

5 Replies

  • Hi,

     

    Have you seen this one? https://devcentral.f5.com/s/question/0D51T00006i7Yj4/icontrol-rest-getting-pool-member-status

     

    Basically, this should be your curl request (change the name of the pool/IP and add user/pass):

     

    curl --request GET --url 'https://192.168.10.31/mgmt/tm/ltm/pool/~Common~wiki-pool/members/stats'

     

    • iAzhar's avatar
      iAzhar
      Icon for Nimbostratus rankNimbostratus

      Thanks  , I am able to use this to get a response.

      In the API response, I am assuming the key "monitorStatus" indicates whether the member is down or up, is this correct?

      • AlexBCT's avatar
        AlexBCT
        Icon for Cumulonimbus rankCumulonimbus

        That's correct.

         

        If you look a bit further down in the response, you can also find these entries;

         

                 "sessionStatus": {

                   "description": "user-disabled"

                 },

                 "status.availabilityState": {

                   "description": "offline"

                 },

                 "status.enabledState": {

                   "description": "disabled"

                 },

                 "status.statusReason": {

                   "description": "Forced down"

         

        This is showing you if the member is administratively down (Disabled / Forced Offline) - the example above is showing it with Forced Offline configured.

         

        If you're happy with the answer. Would be great if you can flag the item as "Answered" so it can be closed and may benefit the rest of the community.

  • iAzhar's avatar
    iAzhar
    Icon for Nimbostratus rankNimbostratus

    Also, how can I check if a virtual server is up/down via rest call?

    • AlexBCT's avatar
      AlexBCT
      Icon for Cumulonimbus rankCumulonimbus

      Basically anything can be found via iControl, but can be a bit of a search at first. Anything to do with virtual servers, can be found under /mgmt/tm/ltm/virtual (the structure is very similar to TMSH commands). Have a look here for the full guide and setup required for any iControl requests;

       

      https://clouddocs.f5.com/api/icontrol-rest/

       

      Whenever I need to build any iControl commands, I use these pages to reference material.