Getting the IP Address of each Server Connected to a VMS?

Answered

Comments

7 comments

  • Avatar
    Andrey Terentyev

    Hello,

    If you're using v 4.2 we encourage you to upgrade to the latest v5.1

    The latest API you need is /rest/v2/servers, the "endpoints" array in the response.

    0
    Comment actions Permalink
  • Avatar
    Dylan Zumar

    Andrey Terentyev Thanks for the quick reply! We tested with this API on a VMS that has 3 servers, and this field provided us with 4 IP addresses: <private IPv4><IPv6><IPv6><public IPv4>. How should I interpret this response? I also am getting different orders of IPv4/IPv6 for different VMS's as well.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    It's the same information you can find in the "System Administration"->Routing tab in the GUI client.

    Please, read the "Configuring Routing in a Multi-Server Environment" in the built-in help in the GUI client.

    0
    Comment actions Permalink
  • Avatar
    Dylan Zumar

    Andrey Terentyev These are all automated processes on our end using code, so we are wondering if there is a way to parse these responses in a more programmatic/structured way? 

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Dylan,

    As you can see, a response is a JSON object. You can use any language you prefer for parsing responses.

    Here are some examples in python

    https://github.com/networkoptix/nx_open_integrations/tree/master/python/examples

    0
    Comment actions Permalink
  • Avatar
    Dylan Zumar

    Andrey Terentyev Using python to parse a JSON isn't the issue (already have experience with that), but I'm wondering how to interpret this response because it seems to coming in random orders of IPv4s and IPv6s and is unclear what each address corresponds to? And we cannot use the GUI client for this because we are writing code

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    The "endpoints" section contains the address (IPv4 and IPv6) the Server listens at, including the external address if the Server is behind NAT. In other words, each ip address in the list corrsponds to the IP address in the OS the Server runs. You can run

    In Linux

    ip address show

    In Windows

    ipconfig /all

    and compare the addreses with the address in the list returned by API/

    0
    Comment actions Permalink

Please sign in to leave a comment.