1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vSphere Perl SDK on Mac OS X

Last updated at Posted at 2016-09-10

Mac OS XにvSphere Perl SDKをインストールする。

単純にperl Makefile.PLをするとライブラリが不足する。

$ sudo perl Makefile.PL 
Warning: prerequisite Class::MethodMaker 2.08 not found.
Warning: prerequisite Crypt::SSLeay 0.51 not found.
Warning: prerequisite SOAP::Lite 0.67 not found.
Warning: prerequisite UUID 0.03 not found.
Writing Makefile for VIPerlToolkit
Writing MYMETA.yml and MYMETA.json

そこで、必須のライブラリをインストール。

$ sudo perl -MCPAN -e shell
Password:
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Class::MethodMaker Crypt::SSLeay SOAP::Lite UUID

そのままだと、SOAPにエラーが出る。

vmware-vsphere-cli-distrib $ apps/vm/vminfo.pl --server vcenter.local --username administrator@vsphere.local --password VMware1\! --vmname esx-01a
SOAP request error - possibly a protocol issue: <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RetrievePropertiesResponse xmlns="urn:vim25"><returnval><obj type="VirtualMachine">vm-297</obj><propSet><name>name</name><val xsi:type="xsd:string">controlcenter (1)</val></propSet></returnval><returnval><obj type="VirtualMachine">vm-296</obj><propSet><name>name</name><val xsi:type="xsd:string">esx-compute-03a</val></propSet></returnval><returnval><obj type="VirtualMachine">vm-293</obj><propSet><name>name</name><val xsi:type="xsd:string">esx-mgmt-01a</val></propSet></returnval><returnval><obj type="VirtualMachine">vm-291</obj><propSet><name>name</name><val xsi

そこで、libwww-perlを対応したバージョンに置き換え。

vmware-vsphere-cli-distrib $ sudo perl -MCPAN -e shell 
Password:
Terminal does not support AddHistory.

cpan[2]> i /libwww-perl/
Distribution    ETHER/libwww-perl-6.15.tar.gz
Distribution    GAAS/libwww-perl-5.837.tar.gz
Distribution    GAAS/libwww-perl-6.03.tar.gz
Author          LWWWP ("The libwww-perl mailing list" <libwww@perl.org>)
4 items found

cpan[3]> install GAAS/libwww-perl-5.837.tar.gz
Running make for G/GA/GAAS/libwww-perl-5.837.tar.gz
-- snip --
Installing /usr/local/bin/lwp-download
Installing /usr/local/bin/lwp-dump
Installing /usr/local/bin/lwp-mirror
Installing /usr/local/bin/lwp-request
Installing /usr/local/bin/lwp-rget
Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod
  GAAS/libwww-perl-5.837.tar.gz
  /usr/bin/make install  -- OK

cpan[4]> exit
Terminal does not support GetHistory.
Lockfile removed.

動作確認。

$ apps/vm/vminfo.pl --server vcenter.local --username administrator@vsphere.local --password VMware1\! --vmname esx-01a

Information of Virtual Machine esx-01a 

Name:		 esx-01a 
No. of CPU(s):		 2 
Memory Size:		 8192 
Virtual Disks:		 1 
Template:		 0 
vmPathName:		 [datastore-Hybrid] esx-01a/esx-01a.vmx 
Guest OS:		 Not Known 
guestId:		 Not Known 
Host name:		 Not Known 
IP Address:		 Not Known 
VMware Tools:		 VMware Tools has never been installed or has not run in the virtual machine. 
Cpu usage:		 0 MHz 
Host memory usage:		 0 MB 
Guest memory usage:		 0 MB 
Overall Status:		 The entity is OK
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?