lampe
New member
Hallo zusammen
Ich versuch's mal hier und hoffe es kann mir jemand helfen.
Ich schreibe gerade ein kleines Script, welches auf einen ESX verbindet und HW ausliest {Server : CPU : RAM : OS : HW}.
Ich stosse an das Problem, dass ich wissen sollte, welche virtuelle Maschine auf welchem Stück Hardware läuft! Kann mir da jemand helfen?
Hier noch mein Code:
Grüsse Andrea
Ich versuch's mal hier und hoffe es kann mir jemand helfen.
Ich schreibe gerade ein kleines Script, welches auf einen ESX verbindet und HW ausliest {Server : CPU : RAM : OS : HW}.
Ich stosse an das Problem, dass ich wissen sollte, welche virtuelle Maschine auf welchem Stück Hardware läuft! Kann mir da jemand helfen?
Hier noch mein Code:
PHP:
#!/usr/bin/perl
use strict;
use warnings;
use VMware::VIRuntime;
use VMware::VmPerl::VM;
use VMware::VmPerl::Server;
use VMware::VmPerl::ConnectParams;
Opts::parse();
Opts::validate();
Util::connect();
my $entity_type = 'VirtualMachine';
my $entity_views = Vim::find_entity_views(
view_type => $entity_type,
filter => {'name' => qr/^s[0d]06[0-9]/,
'config.guestFullName' => qr/Red Hat/,
}
);
$Data::Dumper::Sortkeys = 1; #Sort the keys in the output
$Data::Dumper::Deepcopy = 1; #Enable deep copies of structures
$Data::Dumper::Indent = 2; #Output in a reasonable style (but no array indexes)
foreach my $entity_view (@$entity_views) {
my $entity_name = $entity_view->name;
my $mydevs = $entity_view->config->hardware->device;
my $cpus = $entity_view->config->hardware->numCPU;
my $powerstat = $entity_view->runtime->powerState->val;
my $memory = $entity_view->config->hardware->memoryMB;
my $a = $entity_view->config->locationId;
print $entity_name . " " . "CPU's:" . " " . $cpus . " " . "Status:" . " " . $powerstat . " " . "Memory(RAM):" . " " . $memory . " " . $a . " " . "\n";
}
# Disconnect from the server
Grüsse Andrea