BaldMansMojo / check_vmware_esx

chech_vmware_esx Fork of check_vmware_api.pl
GNU General Public License v2.0
124 stars 67 forks source link

troubles with esxi Server version unavailable #117

Closed asterlab closed 7 years ago

asterlab commented 7 years ago

./check_vmware_esx -H hostname -t 500 -u readonly -p 'verysecretpasswordIdkillyouafteryouknow' -S vmfs -s datastore1 -c 80

Server version unavailable at 'https://hostname:443/sdk/vimService.wsdl' at /usr/local/share/perl/5.24.1/VMware/VICommon.pm line 734

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";
  #To remove host verification
  $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

} my $url = shift; if ($url =~ s|http(s?)://(.)/sdk.|http$1://$2/sdk/vimService.wsdl|i) {

bug 288336

  # if ($1 eq "s") {
     # eval {
        # require Crypt::SSLeay;
        # Crypt::SSLeay->import();
     # };
     # if ($@) {
        # die "Crypt::SSLeay is required for https connections, but could not be loaded: $@";
     # }
  # }

  my $temp_addr = $2;
  if ($temp_addr =~ /:/) {
     if (($temp_addr =~ tr/:/:/) > 1) {
        require Net::INET6Glue::INET_is_INET6;
     }
  }

  my $user_agent = LWP::UserAgent->new(agent => "VI Perl");
  my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);
  $user_agent->cookie_jar($cookie_jar);
  $user_agent->protocols_allowed(['http', 'https']);

  my $http_header = HTTP::Headers->new(Content_Type => 'text/xml');
  my $request = HTTP::Request->new('GET', $url);

  my $response = $user_agent->request($request);

  if ($response->content =~ /Connection refused/) {
     die $response->content . "\n";
  } elsif ($response->content =~ /Bad hostname/) {
     # Loading IPv6 module, to check hostname
     eval {
          require Net::INET6Glue::INET_is_INET6;
     };
     if ($@){
        die $response->content . "\n";
     }
     $response = $user_agent->request($request);
     # Still not able to resolve hostname
     if ($response->content =~ /Bad hostname/) {
       die $response->content . "\n";
     }

vimService.wsdl.txt

BaldMansMojo commented 7 years ago

Thanks.But this is part of the Perl SDK 6.x . 6.x is untested by me because I wasn't able to run 6.x under CentOS/RedHat 6.x. But SDK 5.x is sufficient unless I don't use feature of 6.x

Regards Martin

asterlab commented 7 years ago

Thanks for your reply Martin.

The only vmware server that is giving problems with your plugins is the 6.5 esxi. can I have a patch so that I can use the standard/stable version of your plugin on all the rest of the servers that are giving correct reports (same perl vmdk 6.x) and the other "experimental" version on the 6.5 ?

From: "Martin Fuerstenau" notifications@github.com To: "BaldMansMojo/check_vmware_esx" check_vmware_esx@noreply.github.com Cc: "asterlab" renato@aster-lab.com, "Author" author@noreply.github.com Sent: Lunedì, 7 agosto 2017 10:58:52 Subject: Re: [BaldMansMojo/check_vmware_esx] troubles with esxi Server version unavailable (#117)

Thanks.But this is part of the Perl SDK 6.x . 6.x is untested by me because I wasn't able to run 6.x under CentOS/RedHat 6.x. But SDK 5.x is sufficient unless I don't use feature of 6.x

Regards Martin

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/BaldMansMojo/check_vmware_esx/issues/117#issuecomment-320609064 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AdTiYvbng0L8ZGphdEdP9ikzQlkpOjSmks5sVtHMgaJpZM4Otzue | mute the thread ] .

BaldMansMojo commented 7 years ago

As mentioned the problem is not within the plugin. It|s within the SDK. And I won't patch Vmware's Perl SDK. So test with the CLI which comes with the SDK. I recommend SDK 5.x. If I remeber corrctly downgrading libwww-perl should fix it. But please look into old issues.

asterlab commented 7 years ago

why then with the same sdk it works with all the others esxi ?

From: "Martin Fuerstenau" notifications@github.com To: "BaldMansMojo/check_vmware_esx" check_vmware_esx@noreply.github.com Cc: "asterlab" renato@aster-lab.com, "Author" author@noreply.github.com Sent: Lunedì, 7 agosto 2017 11:51:52 Subject: Re: [BaldMansMojo/check_vmware_esx] troubles with esxi Server version unavailable (#117)

As mentioned the problem is not within the plugin. It|s within the SDK. And I won't patch Vmware's Perl SDK. So test with the CLI which comes with the SDK. I recommend SDK 5.x. If I remeber corrctly downgrading libwww-perl should fix it. But please look into old issues.

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/BaldMansMojo/check_vmware_esx/issues/117#issuecomment-320621020 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AdTiYlAmPjzXufS6217xh3J6C-HBAIIbks5sVt44gaJpZM4Otzue | mute the thread ] .

asterlab commented 7 years ago

by the way yes I read around the whole forum before posting

From: "Renato Gallo" renato@aster-lab.com To: "BaldMansMojo" reply@reply.github.com Sent: Lunedì, 7 agosto 2017 11:55:02 Subject: Re: [BaldMansMojo/check_vmware_esx] troubles with esxi Server version unavailable (#117)

why then with the same sdk it works with all the others esxi ?

From: "Martin Fuerstenau" notifications@github.com To: "BaldMansMojo/check_vmware_esx" check_vmware_esx@noreply.github.com Cc: "asterlab" renato@aster-lab.com, "Author" author@noreply.github.com Sent: Lunedì, 7 agosto 2017 11:51:52 Subject: Re: [BaldMansMojo/check_vmware_esx] troubles with esxi Server version unavailable (#117)

As mentioned the problem is not within the plugin. It|s within the SDK. And I won't patch Vmware's Perl SDK. So test with the CLI which comes with the SDK. I recommend SDK 5.x. If I remeber corrctly downgrading libwww-perl should fix it. But please look into old issues.

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/BaldMansMojo/check_vmware_esx/issues/117#issuecomment-320621020 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AdTiYlAmPjzXufS6217xh3J6C-HBAIIbks5sVt44gaJpZM4Otzue | mute the thread ] .