check_esx3.pl Nagios plugin error (Server version unavailable)

Written by - 2 comments

Published on - Listed in Nagios VMware Linux Virtualization Monitoring


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?


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder