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

Error connecting to server at 'https://{IP}/sdk/webService': Connection refused #159

Closed HigH-HawK closed 5 years ago

HigH-HawK commented 5 years ago

Hi guys,

I was looking for a Nagios Plugin to check present snapshots on our ESXi hosts and warn in Icinga2, if there are any present for more than xx days.

I found your fork and did everything it said in the Readme but for some reason it does not work for all our ESXi hosts.

This is the constellation we are using:

We have several servers with just VMware ESXi installed and they are working fine as I can query them with the Perl script.

We however do also have VMware vSphere server which has a datacenter and some clusters and hosts in the clusters. Now when I use the Perl script as follows to query the hosts in the cluster or the VMware vSphere server itself, I always get the error message in the title.

Command (Host in cluster):

./check_vmware_esx.pl -H 11.11.11.11 -u User -p Password --select=snapshots --warning 1 --critical 2

Normally the error "connection refused" leads me checking our firewall, since it could be blocking something but this is not the case this time. Could it be, that the VMware vSphere Server or any of the hosts is blocking something?

Any help would be appreciated.

BaldMansMojo commented 5 years ago

Hi, can you post an output from testing from the command line. By the way - this is no fork. It's the original. ;-))

HigH-HawK commented 5 years ago

Oh dear, well that was a good start then, calling it a fork. Sorry about that

Sure, didn't think about posting the output, but here it is:

VMware ESXi Command:

./check_vmware_esx.pl -H 11.11.11.11 -u User -p Password --select=snapshots --warning 1 --critical 2

VMware ESXi Output:

OK: No VMs with outdated snapshots found.

VMware vSphere Command: (Host in Cluster)

./check_vmware_esx.pl -H 22.22.22.22 -u User -p Password --select=snapshots --warning 1 --critical 2

VMware vSphere Output: (Host in Cluster)

Error connecting to server at 'https://22.22.22.22/sdk/webService': Connection refused
BaldMansMojo commented 5 years ago

Ok. Seems clear. What happens if you try to connect with a browser or a tool like curl or wget at that URL? I think this problem is not caused by the plugin. It's caused by VMWare server connection or firewall or routing. You can also try the command line tools deliverd with VMware's SDK for first test. If you can't check it directly try checking via Vcenter. I normally avoid this because if the Vcenter is down all checks will even if the servers are ok.

HigH-HawK commented 5 years ago

You are right, since the output with curl gives me a similar result.

VMware ESXi Command:

curl -k https://11.11.11.11

VMware ESXi Output:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf8">
    <meta http-equiv="refresh" content="0;URL='/ui'"/>
</head>
</html>

Whereas the direct Host query of the vCenter server gives me the following.

VMware vSphere Command: (Host in Cluster)

curl -k https://22.22.22.22

VMware vSphere Output: (Host in Cluster)

curl: (7) Failed to connect to 22.22.22.22 port 443: Connection refused

But I can access the above URL in my browser and enter my credentials without any problems. So it looks like, only the host I use the curl or the check query on, cannot access this server. Do you think that it may be a Firewall setting on the ESXi host itself?

BaldMansMojo commented 5 years ago

Sorry - can't help because I can't reproduce the error.And it's not an issue for the plugin.