wmare下 host端如何更精确的取得虚拟机的状态

本文介绍VMCIsocket,由vmware开发的一种通信机制,允许esxi主机与虚拟机中的操作系统在无网络环境下通信。适用于Windows和Linux系统,通过特定命令执行性能监控。提供代码仓库与使用说明。

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   

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值