-
Notifications
You must be signed in to change notification settings - Fork 271
Metric collection compatibility enhancement #1621
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9cfd231
Metric collection compatibility enhancement
aliask 90aecbf
WIP: Use conf.d and yq to merge configs
aliask ee143a0
Generate final config in entrypoint
aliask 0249704
Allow complete override of config file if required
aliask 835f088
Remove cryptowat_exporter
aliask f1e3ab0
Fixes for rootless mode
aliask 2d33868
Remove PROM_CFG_OVERRIDE
aliask 156d31b
Fix path ambiguity issues, run prometheus via exec
aliask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Ensure user-added configs don't get mixed up in git | ||
| .conf.d/* | ||
| !.conf.d/internet-scraper.yml | ||
| !.conf.d/coingecko-scraper.yml | ||
| custom-prom.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,13 @@ | ||
| ARG YQ_TAG=4.35.2@sha256:54e3310f27cb1776b2d2a8c66e4644fe5691a066c62583c82e6eadeb531a3c6c | ||
| ARG YQ_REPO=mikefarah/yq | ||
| FROM $YQ_REPO:$YQ_TAG AS yq | ||
|
|
||
| FROM prom/prometheus:latest | ||
|
|
||
| COPY ./*-prom.yml /etc/prometheus/ | ||
| COPY --from=yq /usr/bin/yq /usr/local/bin/yq | ||
|
|
||
| COPY base-config.yml rootless-base-config.yml /etc/prometheus/ | ||
| COPY ./rootless/*.yml /etc/prometheus/rootless/ | ||
| COPY --chown=nobody:nobody ./make-config.sh /usr/local/bin/ | ||
| COPY --chown=nobody:nobody ./rootless/choose-config.sh /usr/local/bin/ | ||
| # Belt and suspenders | ||
| RUN chmod -R 755 /usr/local/bin/* | ||
| USER root | ||
| RUN chown nobody:nobody /etc/prometheus/*.yml | ||
| RUN chown nobody:nobody /etc/prometheus/rootless/*.yml | ||
| USER nobody | ||
|
|
||
| ENTRYPOINT make-config.sh | ||
| CMD ["/bin/prometheus", "--storage.tsdb.path=/prometheus", "--web.console.libraries=/usr/share/prometheus/console_libraries", "--web.console.templates=/usr/share/prometheus/consoles"] | ||
| COPY ./docker-entrypoint.sh /usr/local/bin/ | ||
|
|
||
| ENTRYPOINT [ "docker-entrypoint.sh" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # This file is not intended to be modified - any changes here could be overwritten next time you update. | ||
| # If you just need to add some new scrape targets to Prometheus, place these in the conf.d folder. | ||
| # You can use the existing files as inspiration, and the docs are here: | ||
| # https://prometheus.io/docs/prometheus/latest/configuration/configuration/ | ||
| # | ||
| # If you need to override the settings in this file, or add other top-level configuration | ||
| # (e.g.) remote_write config, please use custom-prom.yml. | ||
| # The modifications in that file will supercede the settings here (or extend, in the case of lists) | ||
|
|
||
| global: | ||
| scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. | ||
| scrape_timeout: 12s # Timeout must be shorter than the interval | ||
| evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. | ||
|
|
||
| # Service detection from the Docker socket. | ||
| # | ||
| # If you have extra containers you'd like to monitor, you will need to add the following labels: | ||
| # - `metrics.scrape=true` | ||
| # - `metrics.port=<the metrics port>` | ||
| # And you will have to ensure that the container is connected to the same network by including | ||
| # `ext-network.yml` in your .env file. | ||
| scrape_configs: | ||
| - job_name: 'docker' | ||
| docker_sd_configs: | ||
| - host: unix:///var/run/docker.sock | ||
| relabel_configs: | ||
| - source_labels: [__meta_docker_container_label_metrics_scrape] | ||
| regex: true | ||
| action: keep | ||
| - source_labels: [__meta_docker_container_label_com_docker_compose_service] | ||
| target_label: job | ||
| - source_labels: [__meta_docker_container_label_com_docker_compose_project] | ||
| target_label: project | ||
| - action: replace # Optional: override metrics_path using metrics.path (default is /metrics) | ||
| regex: (.+) | ||
| source_labels: | ||
| - __meta_docker_container_label_metrics_path | ||
| target_label: __metrics_path__ | ||
| - action: replace # Required: Configure the HTTP host and port to scrape using metrics.port | ||
| regex: ([^:]+)(?::\d+)?;(\d+) | ||
| replacement: $1:$2 | ||
| source_labels: | ||
| - __address__ | ||
| - __meta_docker_container_label_metrics_port | ||
| target_label: __address__ | ||
| - action: replace # Optional: Sets Prometheus 'job' label using metrics.job, otherwise uses the compose service name | ||
| regex: (.+) | ||
| source_labels: | ||
| - __meta_docker_container_label_metrics_job | ||
| target_label: job | ||
| - action: replace # Optional: override the global scrape interval using metrics.interval | ||
| regex: (.+) | ||
| source_labels: | ||
| - __meta_docker_container_label_metrics_interval | ||
| target_label: __scrape_interval__ | ||
|
|
||
| scrape_config_files: | ||
| - /etc/prometheus/conf.d/*.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Scrape Coingeck price feeds | ||
|
|
||
| scrape_configs: | ||
| - job_name: 'json' | ||
| metrics_path: /probe | ||
| scrape_interval: 300s | ||
| params: | ||
| module: [default] | ||
| static_configs: | ||
| - targets: | ||
| - https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd | ||
| relabel_configs: | ||
| - source_labels: [__address__] | ||
| target_label: __param_target | ||
| - source_labels: [__param_target] | ||
| target_label: instance | ||
| - target_label: __address__ | ||
| replacement: json-exporter:7979 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Checking internet connectivity | ||
|
|
||
| scrape_configs: | ||
| - job_name: 'ping_google' | ||
| metrics_path: /probe | ||
| params: | ||
| module: [icmp] | ||
| static_configs: | ||
| - targets: | ||
| - 8.8.8.8 | ||
| relabel_configs: | ||
| - source_labels: [__address__] | ||
| target_label: __param_target | ||
| - source_labels: [__param_target] | ||
| target_label: instance | ||
| - target_label: __address__ | ||
| replacement: blackbox-exporter:9115 | ||
| - job_name: 'ping_cloudflare' | ||
| metrics_path: /probe | ||
| params: | ||
| module: [icmp] | ||
| static_configs: | ||
| - targets: | ||
| - 1.1.1.1 | ||
| relabel_configs: | ||
| - source_labels: [__address__] | ||
| target_label: __param_target | ||
| - source_labels: [__param_target] | ||
| target_label: instance | ||
| - target_label: __address__ | ||
| replacement: blackbox-exporter:9115 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,18 @@ | ||
| # Additional config for Prometheus. Modifications here will override the global settings, however | ||
| # in the case of lists (e.g. scrape_configs) new items will be added. | ||
| # This means that it's not possible to override existing scrape target configurations. | ||
|
|
||
| global: | ||
| label_limit: 2000 | ||
| scrape_interval: 10s | ||
| scrape_timeout: 8s | ||
| evaluation_interval: 10s | ||
|
|
||
| remote_write: | ||
| - url: "<Your Metrics instance remote_write endpoint>" | ||
| basic_auth: | ||
| username: "your Grafana Cloud username" | ||
| password: "your Grafana Cloud API key" | ||
|
|
||
| scrape_configs: | ||
| - job_name: Another job |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.