Hi,
I want to get Gateway’s Mac Address,IP address,Hostname using
Losant edge work flow.
I took a look on “agentEnviroment”.
.
But the Hostname is some object format.
How to get the exact Hostname?
Thanks,
Sivasankari S
Hi,
I want to get Gateway’s Mac Address,IP address,Hostname using
Losant edge work flow.
I took a look on “agentEnviroment”.
.
But the Hostname is some object format.
How to get the exact Hostname?
Thanks,
Sivasankari S
Hi @sivasankari_s2,
Just a couple questions so I can assist further. Are you including the Gateway Hostname as an Environment Variable on container startup? What is the expected format? I believe the HOSTNAME
included in your screenshot above denotes the Hostname of the container, are you including the Gateway’s as well?
Thanks,
Julia
Hi julia,
Thanks for your reply.
I got the Container Id as a hostname.But I need a gatway’s name(Computer Name)
and MAC address ,IPaddress
Image 1:Container Details
Image 2.Gateways IP and MAC Address in commandline
Thanks,
Sivasankari S
Hi @sivasankari_s2,
In order to access these variables in an Edge Workflow, they must be included as an Environment Variable on the container startup. In order to obtain the IP address and MAC address, I use commands that are specific to my MacOS operating system. Depending on your operating system, this command will vary. The command ifconfig en1 | awk '/ether/{print $2}'
returns the MAC address of my device, and I include it as an environment variable on container startup:
am running with a config file, but am including the DOCKER_HOST
environment variable:
docker run -d --restart always --name -e “DOCKER_HOST=$(ifconfig en1 | awk '/ether/{print $2}’)” -v /var/lib/losant-edge-agent/data:/data -v /var/lib/losant-edge-agent/config.toml:/etc/losant/losant-edge-agent-config.toml losant/edge-agent
Over in my workflow, my debug log shows that my MAC address is included in the payload.
The command to retrieve an IP address on my machine is ipconfig getifaddr en0
, and just as before, I include this as an environment variable:
Then, over in my workflow, I can that my IP address is included on the payload:
Please let me know if I can explain anything further!
Have a great day,
Julia
Thanks for your prompt reply.I will try which is you are mentioned.
Thanks,
Sivasankari S