VMware Nagios monitoring

Follow my latest post on how to install latest VMware Perl SDK 7.0 on ubuntu 22.04. 

1. Download below 2 nagios plugins for VMware host monitoring.

https://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
https://exchange.nagios.org/directory/Plugins/Operating-Systems/%2A-Virtual-Environments/VMWare/Vmware-ESX-%26-VM-host/details

2. For check_esx3.pl, due to Ubuntu 18.04 have change libnagios-plugin-perl to libmonitoring-plugin-perl, need to modify Nagios::Plugin to Monitoring::Plugin.

http://oskibbe.blogspot.com/2013/11/nagios-uberwachung-eines-esx-clusters.html

3. If encounter check_esx3.pl cannot check vmware host status with error "Server version unavailable", edit VICommon.pm.

https://communities.vmware.com/thread/428588
administrator@nagios:/usr/share/perl/5.26/VMware$ diff -u VICommon.pm.bak VICommon.pm
--- VICommon.pm.bak     2018-06-27 03:30:03.456693036 +0000
+++ VICommon.pm 2018-06-27 04:38:29.621885106 +0000
@@ -445,6 +445,7 @@
       $xmlurl = $xmlurl . '/sdk/vimServiceVersions.xml';

       my $user_agent = LWP::UserAgent->new(agent => "VI Perl");
+      $user_agent->ssl_opts( SSL_verify_mode => 0 );
       my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);
       $user_agent->cookie_jar($cookie_jar);
       $user_agent->protocols_allowed(['http', 'https']);
@@ -502,7 +503,7 @@
 sub query_server_version {
    BEGIN {
       #To remove SSL Warning, switching from IO::Socket::SSL to Net::SSL
-      $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
+      #$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
          #To remove host verification
       $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
    }
@@ -526,6 +527,7 @@
          }
       }
       my $user_agent = LWP::UserAgent->new(agent => "VI Perl");
+      $user_agent->ssl_opts( SSL_verify_mode => 0 );
       my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);
       $user_agent->cookie_jar($cookie_jar);
       $user_agent->protocols_allowed(['http', 'https']);
@@ -2108,6 +2110,7 @@
 sub new {
    my ($class, $url) = @_;
    my $user_agent = LWP::UserAgent->new(agent => "VI Perl");
+   $user_agent->ssl_opts( SSL_verify_mode => 0 );
    my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);
    $user_agent->cookie_jar( $cookie_jar );
    $user_agent->protocols_allowed( ['http', 'https'] );
administrator@nagios:/usr/share/perl/5.26/VMware$

4. Or add use Net::SSL; to the check_esx3.pl script.

5. On Ubuntu 22.04, there is no python-pywbem in the apt repository. To get pywbem, install it from pip.

sudo apt-get install python3-pip<
sudo pip3 install pywbem

Comments