Timeout in vSphere check with use of IP instead of DNS

CMK version:
2.1.0p11
OS version:
Ubuntu 20.04 LTS

Description of the problem :
The vsphere special check receives a timeout if we use an IP instead of a FQDN on the command line. “In the webinterface” this only happens after a certain amount of time, round about 60 minutes, after a checkmk restart.

Since checkmk apparently internally only uses IPs this problem occurs again and again. We are also confused about the proxy in the error message since this should not matter using IP or FQDN?

Error message and/or output from below commands:

# Timeout:
./agent_vsphere '-u' 'svc_checkmk' '-sPassword' 'virtualmachine,datastore,counters,licenses' '-P' '--spaces' 'underscore' '--snapshots-on-host' '--no-cert-check' 'xx.xx.xx.xx' --debug

# Works:
./agent_vsphere '-u' 'svc_checkmk' '-sPassword' 'virtualmachine,datastore,counters,licenses' '-P' '--spaces' 'underscore' '--snapshots-on-host' '--no-cert-check' 'FQDN' --debug

# Detailed error message:
./agent_vsphere '-u' 'svc_checkmk' '-spassword' '-i' 'virtualmachine,datastore,counters,licenses' '-P' '--spaces' 'underscore' '--snapshots-on-host' '--no-cert-check' 'IP:xx.xx.xx.xx' --debug
Traceback (most recent call last):
  File "/omd/sites/site/lib/python3.9/site-packages/urllib3/connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "/omd/sites/site/lib/python3.9/site-packages/urllib3/connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "/omd/sites/site/lib/python3.9/site-packages/urllib3/connection.py", line 371, in connect
    self._tunnel()
  File "/omd/sites/site/lib/python3.9/http/client.py", line 930, in _tunnel
    raise OSError(f"Tunnel connection failed: {code} {message.strip()}")
OSError: Tunnel connection failed: 504 Gateway Time-out



During handling of the above exception, another exception occurred:



Traceback (most recent call last):
  File "/omd/sites/site/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/omd/sites/site/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/omd/sites/site/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='IP:xx.xx.xx.xx', port=443): Max retries exceeded with url: /sdk (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 504 Gateway Time-out')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/omd/versions/2.1.0p11.cre/share/check_mk/agents/special/./agent_vsphere", line 13, in <module>
    sys.exit(main())
  File "/omd/sites/site/lib/python3/cmk/special_agents/agent_vsphere.py", line 2009, in main
    esx_connection = ESXConnection(opt.host_address, opt.port, opt)
  File "/omd/sites/site/lib/python3/cmk/special_agents/agent_vsphere.py", line 1126, in __init__
    self.system_info = self._fetch_systeminfo()
  File "/omd/sites/site/lib/python3/cmk/special_agents/agent_vsphere.py", line 1148, in _fetch_systeminfo
    response = self._session.postsoap(SoapTemplates.SYSTEMINFO)
  File "/omd/sites/site/lib/python3/cmk/special_agents/agent_vsphere.py", line 1090, in postsoap
    return super().post(self._post_url, data=soapdata, verify=self.verify)
  File "/omd/sites/site/lib/python3.9/site-packages/requests/sessions.py", line 577, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/omd/sites/site/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/omd/sites/site/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/omd/sites/site/lib/python3.9/site-packages/requests/adapters.py", line 513, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='IP:xx.xx.xx.xx', port=443): Max retries exceeded with url: /sdk (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 504 Gateway Time-out')))

Schau mal, ob das Zertifikat deines vCenters auch für die IP ausgestellt ist, oder nur für den FQDN.

Vielen Dank für den Tipp! Hat eine Weile gedauert bis ich das probieren konnte. Das Zertifikat hatte keine IP. Das ist jetzt geändert. Leider besteht das Problem weiterhin mit derselben Fehlermeldung.

Besteht das Problem auch noch mit dem aktuellsten Patch Release?

Leider ja. Gestern gleich ausprobiert. :frowning:

Mein Bauchgefühl sagt mir, dass da irgendwas am vCenter schief ist, da es auf verschiedene Anfragen verschieden reagiert. Du hast nicht zufällig die Möglichkeit ein anderes vCenter mal zu testen?

Wenn dein Bauchgefühl stimmt, sind zwei vCenter schief. :laughing: Es ist jetzt getestet mit

  • zwei verschiedenen vCenter
  • in zwei unterschiedliche Netze
  • und zwei verschiedenen OS (Ubuntu / Redhat).
  • Dabei ist jeweils mit und ohne die vorgeschlagene Zertifikatslösung und
  • mit Proxyausnahmen konfiguriert.

Trotzdem bleibt leider das Problem. :person_shrugging:

Fehler steht doch eigentlich eindeutig hier.

Irgendwo ist ein System Proxy gesetzt auf dem Monitoring Server.
Ich vermute hier mal, dass es im Proxy Ausnahmen gibt wenn jemand mit internen Hostnamen kommt aber nicht wenn eine Anfrage per IP rein kommt.
Würde jedenfalls das Verhalten erklären.

Es ist leider deutlich “stranger”. :wink:
Auf dem Ubuntu läuft der check inzwischen zuverlässig. Das tut er, seitdem zusätzlich eine free Edition von checkmk installiert wurde. :person_shrugging:
Bei RHEL ist die Syntax für die Proxyausnahmen anders als bei Ubuntu. Jetzt ist die IP des vSphere nochmal explizit angegeben und es funktioniert auch da.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.