davidungurean's Posts

Hi, Can anyone guide me to build a pers script witch should gather information about VM? Such as the data center, cluster, and other information about the vm. I tried with the script below, but fo... See more...
Hi, Can anyone guide me to build a pers script witch should gather information about VM? Such as the data center, cluster, and other information about the vm. I tried with the script below, but for some DC it crashes it triggers the error:   Can't load class 'ClusterComputeResourceHCIConfigInfo'   My Script is this: my $dc_views = Vim::find_entity_views(view_type => 'Datacenter'); foreach my $dc (@$dc_views) {     my $datacenter =$dc->name;     $log->info("Datacenter:$datacenter");     my $clu_views = Vim::find_entity_view ( view_type => "ClusterComputeResource", begin_entity => $dc );         foreach my $cls (@$clu_views)         {              my $cluster = $cls->name;              $log->info(" Cluster:$cluster");              my $vm_views = Vim::find_entity_views(view_type => 'VirtualMachine', begin_entity => $cls);              foreach my $vm(@$vm_views)              {                     my $vm_obj = new VM_summary_obj();                     my $hddCount = 0;                     my $disksKB = 0;                     my $disksGB = 0;                     my $guestFamily = $vm->guest->guestFamily;                     my $guestFullName = $vm->config->guestFullName;                                    $vm_obj->setName ($vm->name);                    $vm_obj->setCpuNum ($vm->config->hardware->numCPU);                    $vm_obj->setCpuCoresPerSocket ($vm->config->hardware->numCoresPerSocket);                    $vm_obj->setMemoryMB ($vm->config->hardware->memoryMB);                    $vm_obj->setGuestFullName ($vm->config->guestFullName);                    $vm_obj->setGuestFamily ($guestFamily);                    $vm_obj->setIpAddress ($vm->guest->ipAddress);                    $vm_obj->setDevices ($vm->config->hardware->device);                    $vm_obj->setDatacenter ($datacenter);                    $vm_obj->setCluster ($cluster);                    my $devices = $vm_obj->getDevices();                    foreach my $device (@$devices)                    {                           my $summary = $device->deviceInfo->summary;                          my $label = $device->deviceInfo->label;                          if (index($label, "Hard disk") != -1)                         {                               $disksKB += $device->capacityInKB;                               $hddCount++;                        }                    }                   $disksGB = $disksKB / (1024*1024) ;                   $vm_obj->setDiskCount($hddCount);                   $vm_obj->setDiskTotalSize($disksGB);            }        } } Thank you!