Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
7.97k stars 1.73k forks source link

getting ResourceWarning: unclosed <socket.socket fd=17, family=AddressFamily.AF_INET #3205

Open pawanyoda opened 2 years ago

pawanyoda commented 2 years ago

I have deployed elastalert but it is giving me a warning after all the rules process. It seems this error coming for open files and not closed. Dockerfile:

FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install python3 python3-pip -y
RUN pip3 install elastalert
RUN useradd -u 1000 alert
WORKDIR /opt
RUN mkdir -p /rules
ADD rules /rules
COPY config/config.yaml /opt/
ADD config/startup.sh /usr/local/bin/startup.sh
RUN chmod +x /usr/local/bin/startup.sh
USER alert
CMD ["/usr/local/bin/startup.sh"]

startup.sh

#!/usr/bin/bash
/usr/local/bin/elastalert-create-index
/usr/local/bin/elastalert --verbose --config /opt/config.yaml

Error:

INFO:elastalert:Ran 4XX Error code on Apache Service from 2021-08-23 11:06 UTC to 2021-08-23 11:21 UTC: 0 query hits (0 already seen), 0 matches, 0 alerts sent
INFO:elastalert:Background configuration change check run at 2021-08-23 11:21 UTC
INFO:elastalert:Background alerts thread 0 pending alerts sent at 2021-08-23 11:21 UTC
INFO:elastalert:Queried rule ElastAlert Is Down from 2021-08-23 11:07 UTC to 2021-08-23 11:22 UTC: 0 / 0 hits
INFO:elastalert:Ran ElastAlert Is Down from 2021-08-23 11:07 UTC to 2021-08-23 11:22 UTC: 0 query hits (0 already seen), 0 matches, 0 alerts sent
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 37858), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=24, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 37872), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=28, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 38164), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=30, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 38232), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=32, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 38998), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.8/dist-packages/botocore/configprovider.py:466: ResourceWarning: unclosed <socket.socket fd=22, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.10.83.237', 39848), raddr=('169.254.169.254', 80)>
  self._config_var_name = config_var_name
ResourceWarning: Enable tracemalloc to get the object allocation traceback