I have removed all containers except "test" one.
Then I ran python script "monitor-docker-slack.py" and stopped container "test"
Afterr 300 seconds I see this. Seems like script cannot send message to slack.com:443
(app-root) bash-4.2# /monitor-docker-slack.sh
+ python /monitor-docker-slack.py --check_interval 300 --slack_token XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX --whitelist '' --slack_channel unixteam --msg_prefix 'Monitoring on ncatlnxv17'
OK: Monitoring on ncatlnxv17
OK: detect no stopped or unhealthy containers
ERROR: Monitoring on ncatlnxv17
Detected Stopped Containers:
['/test']: Exited (0) 4 minutes ago
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/urllib3/connectionpool.py", line 595, in urlopen
self._prepare_proxy(conn)
File "/opt/app-root/lib/python3.6/site-packages/urllib3/connectionpool.py", line 816, in _prepare_proxy
conn.connect()
File "/opt/app-root/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/opt/app-root/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/ssl.py", line 814, in __init__
self.do_handshake()
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/opt/app-root/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/opt/app-root/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded with url: /api/chat.postMessage (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/monitor-docker-slack.py", line 151, in <module>
channel = slack_channel, text = err_msg)
File "/opt/app-root/lib/python3.6/site-packages/slackclient/client.py", line 83, in api_call
result = json.loads(self.server.api_call(method, timeout=timeout, **kwargs))
File "/opt/app-root/lib/python3.6/site-packages/slackclient/server.py", line 220, in api_call
return self.api_requester.do(self.token, method, kwargs, timeout=timeout).text
File "/opt/app-root/lib/python3.6/site-packages/slackclient/slackrequest.py", line 85, in do
proxies=self.proxies)
File "/opt/app-root/lib/python3.6/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/opt/app-root/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/app-root/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/opt/app-root/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/opt/app-root/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded with url: /api/chat.postMessage (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))