Get OS type from vms, possibly with python connecting to vm console?

asked 2018-09-13 10:09:01 -0500

frantisek gravatar image

Most of my console.log files are empty (due to migrations) and I need to find out if vms are win or Linux. There is a lot of vms so I need to do it with python3 script. The only idea that came to me is to get a console message, something like Ubuntu 16.04.3 LTS server_name tty1 server_name login: that you would normally see on server console before authentication. I can get console url of server with nova.servers.get_vnc_console('<server_id>', 'novnc'). I thought that I will be able to connect with websocket-client but no luck so far (CERT_NONE in websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) seems not to apply, I get ValueError: empty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIRED). Has someone an idea how can I talk Python3 to vm console? Or is there a better way how to find out if server is running win/lin?

edit retag flag offensive close merge delete


You could look at the image or volume from which they were launched.

Bernd Bausch gravatar imageBernd Bausch ( 2018-09-21 05:00:18 -0500 )edit