Monitoring plugin check_vmware_snapshots with Perl error: Server version unavailable

Written by - 1 comments

Published on - Listed in Perl Monitoring VMware Virtualization

When monitoring VMware vSphere (previously known as vCenter) infrastructures, a very helpful monitoring plugin is check_vmware_snapshots. This monitoring plugin, written in Perl, checks for the number of snapshots and the snapshots' age and alerts if thresholds are reached.

However after an OS upgrade (from Ubuntu 16.04 to 20.04) the plugin stopped working. Instead of displaying the number of snapshots, an error "Server version unavailable" is showing up in the output:

root@monitoring:~# /usr/lib/nagios/plugins/ --server vsphereserver --username "monitoring" --password "secret" --mode age --warning 10 --critical 14
Server version unavailable at 'https://vsphereserver:443/sdk/vimService.wsdl' at /usr/share/perl/5.30/VMware/ line 704.

This error looks eerily familiar; back in 2011 I already came across a similar error related to VMware's API and Perl ( Nagios plugin error - Server version unavailable).

Back then the fix was to add a Perl LWP config setting to disable hostname verfication on the TLS certificate. But the plugin already contains this setting in the second line:


# Extra packages required (URL given for vMA suitable RPMs)
# * Date::Parse from

However with recent Perl (SSL) updates this setting is not enough anymore, as mentioned by GitHub user "PetrMa". 

The solution is to additionally disable SSL verification in the IO::Socket::SSL module. The begin of the modified plugin therefore looks like this:


  eval {
    # required for new IO::Socket::SSL versions
    require IO::Socket::SSL;
    IO::Socket::SSL::set_ctx_defaults( SSL_verify_mode => 0 );

# Extra packages required (URL given for vMA suitable RPMs)
# * Date::Parse from

Right after the plugin modification, the checks worked fine again:

root@monitoring:~# /usr/lib/nagios/plugins/ --server vsphereserver --username "monitoring" --password "secret" --mode age --warning 10 --critical 14
CRITICAL - 1 outdated VM snapshots found!, Snapshot "VM-Snapshot 26.7.2021, 14:58:32" (VM: 'wwtf111') is 25 days old | outdated_snapshots=1snapshots;10;14

Add a comment

Show form to leave a comment

Comments (newest first)

NadaMac from wrote on Oct 14th, 2022:

MANY thanks Claudio
your patch helps ! and it works !!!
we use vSphere SDK for Perl to backup VMs

Your patch was applied at /usr/share/perl/5.32/VMware/
OS debian Bullseye 11.5
Kernel Linux vm-backup 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
Perl v5.32.1
VMware vSphere Perl SDK 7.0U1

have a nice weekend