VMCI socket是vmare開發的,通過vmare自定義socket使得esxi(host)端與客戶操作系統 之間能夠在沒有網絡的情況下進行通信的機制。類似有kvm的qga功能。
esxi端通過vmci socket與虛擬機通信,通過這個機制esxi可以執行虛擬機的各個性能相關的命令,更加具體的瞭解虛擬機的性能。以下是參考vmci socket手冊開發的,vmare下如何獲取虛擬機的狀態
開發的代碼倉庫在:
使用方法如下:https://github.com/yanxiaofeng2016/vmci-socket
vmci-socket
This program is used to communicate between esxi(host) and the operating system running in the virtual machine.The operating system can be either Windows or Linux.
This program is able to input the commands supported by the client operating system on the host side and return the results after the client runs the commands。
# how to use this tools
First, you need to run the binary program "socket" (window for socket.exe) on the client's operating system. and then run the next command on esxi(host) side.
usage for linux system running in virtual machine
client cid:port command
PC#./client 100000:123456 "ls -l"
-rw-r--r--. 1 root root 2236 Jan 4 17:19 client.c
-rw-r--r--. 1 root root 590 Jan 4 17:24 GNUmakefile
-rw-r--r--. 1 root root 379 Jan 4 17:31 README.md
-rw-r--r--. 1 root root 5424 Jan 4 17:19 socket.c
-rw-r--r--. 1 root root 249 Jan 7 11:21 sock-portable.h
-rw-r--r--. 1 root root 310 Jan 7 11:21 sock-posix.c
-rw-r--r--. 1 root root 520 Jan 4 17:20 sock-windows.c
-rwxr-xr-x. 1 root root 317 Jan 4 17:23 vmci-cflags
usage for windows system running in virtual machine
client cid:port command
PC#./client 100000:123456 "ipconfig"
Windows IP Configuration
Ethernet adapter Ethernet0:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
# How to build:
for linux:
PC#make
for window:
PC#make WINDOWS=1
so, the binary "client" is usually for linux because esxi system is derived from Linux.
and the binary "socket" or "socket.exe" need to be compiled for two parts. one is for linux ,the other is for windows system.
more useful tools:
app.py apiserver.py this two files is used to output restful API. So app developer can call standard rest API to implent communication between client side and host side
first,you run app.py and then open a web browser. you can type url like the next example
http://target_host_machine/cid:port/os_command
a special example:
http://127.0.0.1/12345678:1234/ipconfig /all