Monitor VMware vSphere from OpenBSD using the Perl SDK

Last time, I had a look at how to monitor VMware vSphere from FreeBSD using the Perl SDK. Quite simple using the ports!

Believe it or not, installing and running the VMware vSphere Perl SDK on OpenBSD is as simple as breathing. Here’s the POC.

First of all, you’ll need to download the VMware-vSphere-Perl-SDK-5.0.0-422456.i386.tar.gz archive. Browse to the “Download VMware vSphere 5.0 SDK for Per…” Web page, locate the “vSphere SDK for Perl 32-bit Linux Installer” and click “Manually Download” button. You’ll need to log-in using a (free) account.

Once downloaded, transfer the archive to your OpenBSD system.

You’ll need to install a few Perl dependencies to be able to use the SDK:

# pkg_add p5-URI p5-XML-LibXML p5-LWP-UserAgent-Determined # cat >> /usr/local/libdata/perl5/site_perl/XML/SAX/ParserDetails.ini [XML::LibXML::SAX::Parser] = 1

Then, extract the VMware vSphere SDK archive and install the files in the OpenBSD system:

# tar xzf VMware-vSphere-Perl-SDK-5.0.0-422456.i386.tar.gz # cd vmware-vsphere-cli-distrib # cp -pr lib/VMware/share/VMware /usr/local/libdata/perl5/site_perl/i386-openbsd/ # chown -R root:wheel /usr/local/libdata/perl5/site_perl/i386-openbsd/VMware # cp -r apps /usr/local/share/examples/vmware-vsphere-cli # chown -R root:wheel /usr/local/share/examples/vmware-vsphere-cli # find /usr/local/share/examples/vmware-vsphere-cli -type f -name "*.pl" -exec chmod 755 {} \;

Finally, just use the examples to check it works:

# /usr/local/share/examples/vmware-vsphere-cli/host/ --server esxi --username 'admin' --password 'password' Host Name: Port Number: 902 BootTime: 2012-07-27T19:17:17.537519Z Cpu Model: Genuine Intel(R) CPU 0 @ 2.30GHz Cpu Speed: 9179150980 Cpu Usage: 1102 File System: vmfs nfs vfat Host Status: The status is unknown Maintenance mode: 0 Physical Memory: 17087459328 bytes Memory Usage: 13074MB Network Adapters: 2 Reboot Required: 0 Software on host: VMware ESXi 5.0.0 build-768111 VMotion: 0 # /usr/local/share/examples/vmware-vsphere-cli/vm/ --server esxi --username 'admin' --password 'password' --vmname "directory" Information of Virtual Machine directory Name: directory No. of CPU(s): 1 Memory Size: 256 Virtual Disks: 1 Template: 0 vmPathName: [NFS_vm] directory/directory.vmx Guest OS: FreeBSD (32-bit) guestId: freebsdGuest Host name: IP Address: VMware Tools: VMware Tools is running and the version is current Cpu usage: 8 MHz Host memory usage: 132 MB Guest memory usage: 12 MB Overall Status: The entity is OK

It works! Except that the VM is not FreeBSD but OpenBSD 5.1…

1 Comment

  • Craig Mon, 01 Sep 2014 22:04:04 +0000 Reply

    Excellent piece. I’d been searching high and low for a method of querying the HV. for exactly the information that you’ve shown in your examples.

Leave a Reply

Your email address will not be published. Required fields are marked *


%d bloggers like this: