seecloud / availability

Tracks availability of specified services
Apache License 2.0
2 stars 0 forks source link

availability-watcher does not tolerate unavailable elasticsearch #14

Open akscram opened 7 years ago

akscram commented 7 years ago

As you can see the process exited because elasticsearch was unavailable:

Traceback (most recent call last):
  File "/usr/local/bin/availability-watcher", line 11, in <module>
    load_entry_point('availability==0.1', 'console_scripts', 'availability-watcher')()
  File "/usr/local/lib/python2.7/dist-packages/availability/watcher.py", line 149, in main
    if not storage.get_elasticsearch(check_availability=True):
  File "/usr/local/lib/python2.7/dist-packages/availability/storage.py", line 39, in get_elasticsearch
    es.info()
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 71, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 222, in info
    return self.transport.perform_request('GET', '/', params=params)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 327, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 120, in perform_request
    raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f0b6e20a850>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f0b6e20a850>: Failed to establish a new connection: [Errno 111] Connection refused)

Also, this error happened in the function storage.get_elasticsearch(check_availability=True) and it means that this function does not properly work. From the code where this function is used it is clear that this function should return a boolean value.

maretskiy commented 7 years ago

https://github.com/seecloud/availability/pull/15