Tuesday, November 29, 2016

check_vmware_api.pl install is perl hell

 Prerequisites:  
 - Ubuntu 14.04 Server (perl v5.18.2)  
 - VMware-vSphere-Perl-SDK-5.5.0-2043780  
 - check_vmware_api.pl 0.7.1  
   
 Basic installation:  
   
 apt-get install perl-doc libssl-dev libxml-libxml-perl libarchive-zip-perl libcrypt-ssleay-perl libclass-methodmaker-perl libuuid-perl libdata-dump-perl libsoap-lite-perl libio-compress-perl  
 tar -xf VMware-vSphere-Perl-SDK-5.5.0-2043780.x86_64.tar.gz -C /tmp  
 cd /tmp/vmware-vsphere-cli-distrib  
 ./vmware-install.pl  
   
 ...  

 cpan[3]> i /libwww-perl/  
 Distribution  GAAS/libwww-perl-5.837.tar.gz  
 Distribution  GAAS/libwww-perl-6.01.tar.gz  
 Distribution  GAAS/libwww-perl-6.05.tar.gz  
 Author     LWWWP ("The libwww-perl mailing list" <libwww@perl.org>)  
 4 items found  
    
 cpan[4]> install GAAS/libwww-perl-5.837.tar.gz  
 Running make for G/GA/GAAS/libwww-perl-5.837.tar.gz  
 Checksum for /root/.cpan/sources/authors/id/G/GA/GAAS/libwww-perl-5.837.tar.gz ok  
   
 ...  
   
 http://search.cpan.org/dist/Nagios-Plugin/lib/Nagios/Plugin.pm  
 Nagios::Monitoring::Plugin  
   
 Nagios::Plugin <- no longer  
   
 ...  

 Work around for "Server version unavailable":  
   
 patch -b /usr/share/perl/5.14/VMware/VICommon.pm 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'] );  
 *****************************************************************  
 
...  
   
 env -i perl -V  
   
 @INC is yucky.  
   
 command execution via _compile function in Maketext.pm  
  Built under linux  
  Compiled at Feb 4 2014 23:11:19  
  @INC:  
   /etc/perl  
   /usr/local/lib/perl/5.14.2  
   /usr/local/share/perl/5.14.2  
   /usr/lib/perl5  
   /usr/share/perl5  
   /usr/lib/perl/5.14  
   /usr/share/perl/5.14  
   /usr/local/lib/site_perl  
   
 All my new stuff is under /usr/local/lib/perl5/  
 and not /usr/local/lib/site_perl oh come on.  
   
 because   
 Can't locate Monitoring/Plugin/Functions.pm   
 find / | grep -i Functions.pm <- in 5.18.0  
   
 ln -s /usr/local/lib/perl5/site_perl/5.18.0 site_perl  
   
 because  
 Can't locate Params/Validate.pm   
 find / | grep -i Validate.pm <- in 5.24.0  
   
 cd /usr/local/lib/site_perl/Params  
   
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/Validate .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/Validate.pm .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/ValidatePP.pm .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/ValidateXS.pm .  
Post a Comment