How do I obtain the IP address of an agent


(Sebs Sa) #1

i am currently working on a small script that should allow me to scan an existing ioFog network.
Via “iofogctl” I can actually get all the necessary information. However, I do encounter a problem.

The IP addresses displayed do not correspond to the “IP addresses” of the host devices. (Intentionally or not)

Example: Agent “knight” runs on a Raspi with the IP address :

"iofogctl get all" // "iofogctl describe agent knight" give me this value:

@mehdi then gave me the idea to use the ECN Viewer.

Things are getting a little crazy around here. :joy:

A quick look at my setup:

  1. I am on a Windows computer and use iofogctl version: 2.0.0-rc2
  2. I’m connecting through it (iofogctl connect …)
  3. Now I am in the network: Linux laptop (controller) and a Raspberry Pi (agent) (all up to date versions)

4.Still getting : host: and not

  1. Want to try out : iofogctl view

First problem: It opens my browser with the IP address of my Linux laptop (as it should be). That’s where the controller is sitting. BUT unfortunately without port, which leads to the error : “this webpage is not available”.

Luckily, I was able to access my Linux laptop and run “iofogctl view” there and thus found the necessary port.

Second problem: The port does not seem to be the same. (@mehdi had a different one in his setup)

But let’s ignore that for once. The ECN viewer provides me with these values:

"ipAddress": string""
"ipAddressExternal": string""

So is there an easy way to get to the real “host” address?

(Serge Radinovich) #2

Thanks for the thorough explanation.

This is an issue that has been fixed in iofogctl develop branch but has not been pushed to a release yet.

Would you consider building iofogctl from source from the develop branch?

(Sebs Sa) #3

All right! I’m glad to hear it.

@mehdi and I found a workaround to get the IP via the REST-API !

curl -H “Content-Type: application/json” -d “{ “email”: “yourmail”, “password”: “yourpassword”}” http://controlerIP:51121/api/v3/user/login

Note here: The Controller-Rest-Docu shows a example POST you can use. Possibly there could be problems with Windows. See example-Info

This will return a authorization token. Use this token in :

curl -H “Authorization: yourToken” http://controllerIP:51121/api/v3/iofog-list?system=false

This returns a Json with the requested information :partying_face:

At the moment I will use this approach. It also provides some more information overall.
But I am looking forward to the new version ! Keep going!