Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --prometheus_addr command line parameter #1608

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Jan 23, 2025

This commit adds support for the --prometheus_addr command line
parameter to allow binding the Prometheus metrics server on a different
host address.

Reviewer notes

Helm Chart: If your new feature introduces settings consider adding those to the Helm chart README.md and values.yaml

I'm not quite sure how to do this so would like to get some help here if possible.

@tgxworld tgxworld force-pushed the support_prometheus_addr branch from 20d4f4e to e412fa6 Compare January 23, 2025 02:00
This commit adds support for the `--prometheus_addr` command line
parameter to allow binding the Prometheus metrics server on a different
host address.
@tgxworld tgxworld force-pushed the support_prometheus_addr branch from e412fa6 to b33930a Compare January 23, 2025 02:18
@jertel
Copy link
Owner

jertel commented Jan 23, 2025

Kubernetes typically handles the services on its own, so we'll skip adding the address param to the Helm chart.

Since there are no existing tests for the prometheus port we'll skip that as well.

@tgxworld
Copy link
Contributor Author

Since there are no existing tests for the prometheus port we'll skip that as well.

Do you know if there is an existing way to set up elastalert2 and elasticsearch in the development environment for testing purposes? I noticed that there were no existing tests as well but would like to at least be able to test the changes by hand locally.

@jertel
Copy link
Owner

jertel commented Jan 23, 2025

In the docs it shows how to run a local environment directly with Python. I suggest creating a virtual environment (venv) first to avoid collisions with other Python apps.

@tgxworld
Copy link
Contributor Author

@jertel I manage to test my changes locally by hand using the following steps:

  1. docker network create test
  2. docker run --rm --name elasticsearch --net test -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.http.ssl.enabled=false" -e "xpack.security.enabled=false" elasticsearch:8.17.1
  3. Git checkout my changes and build the image locally: docker build . --file Dockerfile --tag elastalert2
  4. mkdir /tmp/rules
  5. cp ./examples/config.yaml.example ./examples/config.yaml
  6. Change the value of es_host: in ./example/config.yaml to elasticsearch
  7. docker run --rm -it --net test -p 9979:9979 -v ./examples/config.yaml:/opt/elastalert/config.yaml -v /tmp/rules:/opt/elastalert/rules elastalert2:latest --prometheus_port 9979 --prometheus_addr "::"

@jertel jertel merged commit c1ca69e into jertel:master Jan 24, 2025
1 check passed
@tgxworld
Copy link
Contributor Author

@jertel Thank you for reviewing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants