Use VMWare perl SDK with Debian Jessie and check_vmware_esx
This is intended for Debian Jessie, it’s not working with Debian Stretch!
Since I needed a few hours to figure out how to get everything working smoothly I want to share my process.
Install the SDK
First of all download the VMWare Perl SDK from here. Install all the dependencies of the SDK:
$ apt-get install libssl-dev perl-doc libsoap-lite-perl libarchive-zip-perl libcrypt-ssleay-perl libclass-methodmaker-perl libdata-dump-perl libtime-duration-perlExtract the tar, change the directory, and edit vmware-install.pl with your favourite editor.
$ tar -xzf VMware-vSphere-Perl-SDK-5.5.0-*
$ cd vmware-vsphere-cli-distrib
$ vim vmware-install.plGo to line 2292 or search for ubuntu and change the line from:
if ( direct_command(“cat /etc/*-release | grep -i ubuntu”) || direct_command(“cat /proc/version | grep -i ubuntu”) ) {to:
if ( direct_command(“cat /etc/*-release | grep -i debian”) || direct_command(“cat /proc/version | grep -i debian”) ) {The Installation Script looks for your operating system but only for ubuntu.
Now it’s finally time to install the SDK:
~/vmware-vsphere-cli-distrib $./vmware-install.plFix flow operator issue in VICommon
Testing the SDK can return this error message Possible precedence issue with control flow operator at /usr/share/perl/5.20/VMware/VICommon.pm line 2147. together with your check result. To get rid of this message you need to change the line 2147 from this:
sub get_session_loaded {
my $self = shift;
my $user_agent = $self->{user_agent};
return defined $user_agent->cookie_jar and
$user_agent->cookie_jar->as_string ne '';
}to this:
sub get_session_loaded {
my $self = shift;
my $user_agent = $self->{user_agent};
return (defined $user_agent->cookie_jar and
$user_agent->cookie_jar->as_string ne '');
}Add brackets to the return statement.
Check the SDK
Now it’s time to check the speed of the SDK.
$ time /usr/lib/vmware-vcli/apps/vm/vminfo.pl --server 10.10.10.10 --username USER --password SECRETSOAP 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>[...]real 3m47.917s
user 0m0.180s
sys 0m0.056s
The result displays a SOAP Request Error and the duration is way too long for querying a few hundred checks per minute.
Luckily there is a solution for this problem from Claudio Kuenzler here. Thank you!
Install the check_vmware_esx plugin
Finally we can install the plugin by following the instructions on the github page. The checks should run pretty smoothly.
As advised, use sessionfiles for large amounts of checks. Otherwise your VCenter / ESXI log fills up amazingly fast and you face performance problems (Believe me I know what I talking about).
Issues with sessionfiles
Using the current version of check_vmware_esx from github you may run into an issue with session files. Another Github User Daniel Schindler provided a commit to fix this issue (thank you!).
Simply change the check_vmware_esx file in line 1768 from this:
if (($@ ne '') || (Opts::get_option("url") ne $url2connect))to:
if ($@ ne '')