Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

check_esx3.pl Nagios plugin error (Server version unavailable)
Friday - Nov 25th 2011 - by - (2 comments)

For years now I've been using OP5's great plugin 'check_esx3.pl' which makes use of the VMware vSphere Perl API to check ESX/i servers.
Now I've set it up on a complete new Nagios system and also with the newest vSphere Perl API (version 5.0 build 422456). The installation of the API requires a lot of Perl modules to be pre-installed, some in a newer version than the one already installed on the OS (here SLES11SP1).

Once all requirements and the API were installed, I launched the plugin to see the following error:

/usr/local/nagios/libexec # ./check_esx3.pl -H MYESX -u MYUSER -p MYPASS -l cpu -s usage
CHECK_ESX3.PL CRITICAL - Server version unavailable at 'https://MYESX:443/sdk/vimService.wsdl' at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545.

At the begin I thought there might be a compatibility problem between the Perl API 5.0 and the ESX server which runs on 4.1, but after a short research, the problem comes from the Perl module LWP, as MWalker describes it on this page.
The solution to this problem is to add a parameter to check_esx3.pl to tell LWP that the self-signed SSL certificate (as they are by default on ESX/i servers) can be ignored:

#!/usr/bin/perl -w
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#
# Nagios plugin to monitor vmware esx servers
#
# License: GPL

Right after saving the modification, the plugin ran fine:

/usr/local/nagios/libexec # ./check_esx3.pl -H MYESX -u MYUSER -p MYPASS -l cpu -s usage
CHECK_ESX3.PL OK - cpu usage=9.02 % | cpu_usage=9.02%;;

Update December 15 2011: By the way, the same error message also appears if one wants to use the vSphere Perl API on a Linux server:

# vihostupdate --server esxserver --query
Enter username: root
Enter password:
Server version unavailable at 'https://esxserver:443/sdk/vimService.wsdl' at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545, line 2.

The solution is more or less the same. Open the program vihostupdate (or another program which gave you the error) and add $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; right after the first perl line:

# vi /usr/bin/vihostupdate

#!/usr/bin/perl -w
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#
# Copyright 2006 VMware, Inc.  All rights reserved.

 

Add a comment

Show form to leave a comment

Comments (newest first):

Claudio from Switzerland wrote on Aug 14th, 2012:
You have to be root to change the file of course. If you are root and the file is set without write permissions (e.g. 407) then you can save the changes on a read-only file by using the command ":wq!" in VIM. Don't forget the exclamation mark, which allows to write a read-only file. But remember you must be root.

superurbi from Spain wrote on Aug 14th, 2012:
I've tried the advised change to vihostupdate but the file is read-only. How can I change then?


Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7059 Days
until Death of Computers
Why?