我尝试从 Perl 的 VMOMI 模块中获取特定 VM 的 VmWare 工具状态,但我不知道该怎么做。
我尝试了什么:
use strict; use warnings;
use VMOMI;
use Data::Dumper;
my $host = 'vcenter1.example.com',
my $user = 'myuser';
my $pass = 'STRONG';
my $stub = new VMOMI::SoapStub(host => $host) || die "Failed to initialize VMOMI::SoapStub";
my $instance = new VMOMI::ServiceInstance(
$stub,
new VMOMI::ManagedObjectReference(
type => 'ServiceInstance',
value => 'ServiceInstance',
),
);
# Login
my $content = $instance->RetrieveServiceContent;
my $session = $content->sessionManager->Login(userName => $user, password => $pass);
my $vm = new VMOMI::VirtualMachineToolsRunningStatus(
$stub,
new VMOMI::VirtualMachineToolsRunningStatus(
type => 'VirtualMachine',
value => 'vm-name-foobar'
)
);
use Data::Dumper;
print Dumper $vm;
# Logout
$content->sessionManager->Logout();
我有一个密钥service_version
,但我猜它是远程 VSphere 服务器的版本。
有什么线索吗?我没有任何 vmware 工具状态,这就是我要找的。
我想我不明白如何使用VirtualMachineToolsRunningStatus
类:/