Skip to content

Commit

Permalink
missing telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelienmaury committed Sep 12, 2024
1 parent a29168d commit 4cbabd6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Load group vars...

ROADMAP SEPTEMBRE:

* Support RHEL family - juillet
* tests mono node complet - aout
* tests offline complet - aout
* statuer sur version stable entre septembre 2024 et janvier 2025
Expand Down
40 changes: 40 additions & 0 deletions roles/alloy/templates/alloy.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,46 @@ prometheus.scrape "vault" {

{% endif -%}

{%- if __hs_alloy_is_consul_service_present %}

prometheus.scrape "consul" {
job_name = "consul"

scrape_interval = "30s"
scrape_timeout = "10s"
scheme = "https"
targets = [
{"__address__" = "{{ hs_node_fqdn }}:8501"},
]
metrics_path = "/v1/agent/metrics"
params = { "format" = ["prometheus"] }

bearer_token = "{{ hs_consul_telemetry_token }}"

forward_to = [prometheus.remote_write.upstream.receiver]
}

{% endif -%}

{%- if __hs_alloy_is_nomad_service_present %}

prometheus.scrape "nomad" {
job_name = "nomad"

scrape_interval = "30s"
scrape_timeout = "10s"
scheme = "https"
targets = [
{"__address__" = "{{ hs_node_fqdn }}:4646"},
]
metrics_path = "/v1/metrics"
params = { "format" = ["prometheus"] }

forward_to = [prometheus.remote_write.upstream.receiver]
}

{% endif -%}

prometheus.remote_write "upstream" {
endpoint {
url = "{{ hs_alloy_prometheus_write_url }}/api/v1/write"
Expand Down
4 changes: 4 additions & 0 deletions roles/alloy/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
__hs_alloy_is_vault_service_present: >-
{{ 'vault.service' in ansible_facts.services }}
__hs_alloy_is_consul_service_present: >-
{{ 'consul.service' in ansible_facts.services }}
__hs_alloy_is_nomad_service_present: >-
{{ 'nomad.service' in ansible_facts.services }}

0 comments on commit 4cbabd6

Please sign in to comment.