Comments (4)
I am open minded to that but I don't have a suitable test environment to support it. In-fact I have never had to use a proxy (lucky me). If you can help me design a simulation of such a thing that would be a great help.
There are two basic groupings of network connections in check_docker
- Connections to docker hosts
- Registries which may be internal or external
I assume we can ignore #1 given your question.
As for #2 however, we may have images from multiple registries only some of which may need a proxy.
So I dug into this and have a bunch of thoughts and questions (in nor particular order).
- The network library I am using, urllib, has something called ProxyHandler that appears to do this. It can be configured directly but also it will look at the current environment variables to find configure itself.
- A question, how do proxies handle internal traffic. If I send everything to the proxy will it bounce the internal traffic back to the internal network? If it doesn't do this then we will have to support configuring proxy on a per-domain basis.
I can add the Proxy handler pretty easily if you want see if works for you.
from check_docker.
Hey, thanks for coming back to me.
I had a look myself but as i said, my programming days are a while back. The ProxyHandler
from urllib
is suppose to check environment variables for the proxy information (if there are any) but it doesn't seem to do that properly because I have my proxy information in the environment variables (HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy).
As for the internal/external traffic, our proxy is setup to handle only external traffic, internal traffic is not being touched by it, as far as I know.
It would be great if you could add the ProxyHandler
and I would be happy to test it and report back to you.
from check_docker.
I have created a branch for this proxy work, https://github.com/timdaman/check_docker/tree/proxy
Here is a direct link to a check_docker.py with the ProxyHandler enabled. https://github.com/timdaman/check_docker/raw/proxy/check_docker/check_docker.py
Hope it works.
from check_docker.
Hi Tim,
I could now test the new check_docker file but am still getting an error:
Command:
./check_docker --containers redmine --version
Error output:
Traceback (most recent call last):
File "/usr/lib64/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib64/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib64/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib64/python3.6/http/client.py", line 1392, in connect
super().connect()
File "/usr/lib64/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib64/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib64/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./check_docker", line 1004, in main
[x.result() for x in futures.as_completed(threads)]
File "./check_docker", line 1004, in <listcomp>
[x.result() for x in futures.as_completed(threads)]
File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "./check_docker", line 654, in check_version
raise e
File "./check_docker", line 642, in check_version
registry_hash = get_digest_from_registry(url)
File "./check_docker", line 393, in get_digest_from_registry
registry_info = head_url(url=url)
File "./check_docker", line 292, in head_url
response = better_urllib_get.open(HeadRequest(url), timeout=timeout)
File "/usr/lib64/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib64/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib64/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
UNKNOWN: Exception raised during check': URLError(ConnectionRefusedError(111, 'Connection refused'),)
I did check whether my proxy server is set in env:
env | grep -i proxy
And I do get http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY back with the proxy address.
from check_docker.
Related Issues (20)
- Filter images by status
- Error trying to use the check_docker.py remotely HOT 1
- CRITICAL: debian's version does not match registry HOT 5
- UNKNOWN: Exception raised during check': KeyError('token')
- containers_runnings not detecting running containers HOT 2
- UNKNOWN: Exception raised during check: TypeError('string indices must be integers',) HOT 5
- Help with container who has multiple tags/names
- Version check for arm images HOT 1
- Greater than 100% CPU utilization is not documented HOT 2
- check_docker cpu provide inconsistent values to Nagios
- ghcr.io/OWNER/IMAGE_NAME
- JSON Decode Error HOT 1
- ImportError HOT 2
- "check swarm status" only works on manager node
- DockerEngine 20.10.10: KeyError: 'total_cache' HOT 4
- Forced combination of no_ok and no_performance
- Got ValueError Exception on memory check HOT 1
- Checks fail with Podman
- Add New Maintainer
- Multiline output support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from check_docker.