Published on InterSystems Developer Community (https://community.intersystems.com)

Home > fetch ip address of cache installation

Question
Kevin Furze · Sep 20, 2018

fetch ip address of cache installation

I'm using cache  win10-x64  version 2017.2.1.801

I want to uniquely identify the installation of cache, and from that create a meaningful unique folder names to store files. 

so to generate \192-168-1-100\KEVDEV\testfolder \ and \192-168-1-5\LIVE\testfolder\

so in this case, I could- use the IPaddress and thesecond part of $SYSTEM (cache instance name) - at least this way, I can instantly see where it came from with little risk of overwriting between cache instance.

looking into the options, I found

generate a unique random folder name (not helpful when trying to understand the contents)

w $SYSTEM - gives DESKTOP-VN0HNSP:KEVDEV (not unique enough ?)

w $SYSTEM.INetInfo.LocalHostName()  - generates DESKTOP-VN0HNSP -this is the first part of $SYSTEM (could change by renaming the computer)

w $SYSTEM.INetInfo.EthernetAddress() - generates 000C292678A - ie mac address (liable to change if the card goes down - what happens on two network cards being installed ?)

w $SYSTEM.INetInfo.HostNameToAddr($SYSTEM.INetInfo.LocalHostName())  - generates 10.0.0.49 (could change, but unlikely - certainly in our network)

the last one generates the IPaddress that the system is installed on but relies on the LocalHostName() to get that number

is there any risks associated with the LocalHostName() call.

can I obtain the IPAddress any other way without using the LocalHostName()  ?

I'm using windows today, but is there any issues if we suddenly swap to linux ? - being a $system call, I assume not

suggestions please.

kevin

#Caché

Source URL:https://community.intersystems.com/post/fetch-ip-address-cache-installation