API does not return console port number

Before posting something, READ the changelog, WATCH the videos, howto and provide following:
Your install is: Bare metal, ESXi, what CPU model, RAM, HD, what EVE version you have, output of the uname -a and any other info that might help us faster.

Moderator: mike

Post Reply
zpolisensky
Posts: 6
Joined: Fri Nov 09, 2018 1:36 pm

API does not return console port number

Post by zpolisensky » Sat Nov 10, 2018 5:12 pm

API node call always returns empty console port number. Node is up and running and using web UI console port number is visible. Is there any way how to get it or is it a bug?
Example:
"16": {
"console": "",
"delay": 0,
"id": 16,
"left": 234,
"icon": "Router.png",
"image": "i86bi-linux-l3-adventerprisek9-15.2.4M1.bin",
"name": "R16",
"ram": 512,
"status": 2,
"template": "iol",
"type": "iol",
"top": 435,
"url": "/html5/#/client/NTE5NTEAYwBteXNxbA==?token=XXX",
"config_list": [],
"config": "0",
"ethernet": 4,
"nvram": 1024,
"serial": 0

Eve-ng PRO: 2.0.4-77-PRO
OS: Ubuntu 16.04 LTS
Platform: Intel Xeon X5600

Thanks
Zbynek

ecze
Posts: 533
Joined: Wed Mar 15, 2017 1:54 pm

Re: API does not return console port number

Post by ecze » Sun Nov 11, 2018 12:07 am

console is not console port but protocol used to connect the device.

IOL ans Dynamips return a null value.

the url is the key used to describe ip/port to use.

In your sample you use a html5 console type session. In this context url return a http type console.

If you want to use API for script, use a native type session.

sample:

Code: Select all

curl -k -s -b /tmp/cookie -c /tmp/cookie -X POST -d '{"username":"admin","password":"eve","html5":"-1"}' https://127.0.0.1/api/auth/login
{"code":200
"status":"success"
"message":"User logged in (90013)."}

curl -k -s -c /tmp/cookie -b /tmp/cookie -X GET -H 'Content-type: application/json' https://127.0.0.1/api/labs/Complex%20LAB%20Security%20perimeter2.unl/nodes/6?_=1541894234716 | sed -e 's/,/\n/g'
{"code":200
"status":"success"
"message":"Successfully listed node (60025)."
"data":{"console":""
"config":"0"
"delay":0
"left":313
"icon":"Switch L3.png"
"image":"i86bi_linux_l2-ipbasek9-ms.high_iron_aug9_2017b.bin"
"name":"SW-Corp"
"status":2
"template":"iol"
"type":"iol"
"top":489
"url":"telnet:\/\/127.0.0.1:34275"
"ethernet":3
"nvram":1024
"ram":1024
"serial":0}}
E.

zpolisensky
Posts: 6
Joined: Fri Nov 09, 2018 1:36 pm

Re: API does not return console port number

Post by zpolisensky » Sun Nov 11, 2018 4:59 pm

OK, got it. Works like a charm.

Thanks a lot for your help.
Zbynek

deltamike99
Posts: 4
Joined: Mon Jun 10, 2019 6:52 pm

Re: API does not return console port number

Post by deltamike99 » Mon Jun 10, 2019 7:08 pm

Would be great if the API How-to at https://www.eve-ng.net/documentation/ho ... eve-ng-api could be updated. I also wanted to get the telnet port number out and was getting the /html5 URL instead of telnet. I didn’t know about the “html5”:”-1” option at the API login.

Anyway, it’s working for me too now so I’m very happy :D

Post Reply