diff --git a/docs/services/prometheus-node-exporter.md b/docs/services/prometheus-node-exporter.md index 764e920..7496639 100644 --- a/docs/services/prometheus-node-exporter.md +++ b/docs/services/prometheus-node-exporter.md @@ -16,11 +16,14 @@ To enable this service, add the following configuration to your `vars.yml` file prometheus_node_exporter_enabled: true -prometheus_node_exporter_hostname: mash.example.com -prometheus_node_exporter_path_prefix: /metrics/node-exporter +# To expose the metrics publicly, enable and configure the lines below: +# prometheus_node_exporter_hostname: mash.example.com +# prometheus_node_exporter_path_prefix: /metrics/node-exporter -prometheus_node_exporter_basicauth_user: your_username -prometheus_node_exporter_basicauth_password: your password +# To protect the metrics with HTTP Basic Auth, enable and configure the lines below: +# prometheus_node_exporter_basicauth_enabled: true +# prometheus_node_exporter_basicauth_user: your_username +# prometheus_node_exporter_basicauth_password: your password ######################################################################## # # @@ -29,8 +32,10 @@ prometheus_node_exporter_basicauth_password: your password ######################################################################## ``` +Unless you're scraping the Prometheus Node Exporter metrics from a local [Prometheus](prometheus.md) instance, as described in [Integrating with Prometheus Node Exporter](prometheus.md#integrating-with-prometheus-node-exporter), you will probably wish to expose the metrics publicly so that a remote Prometheus instance can fetch them. + ## Usage After you installed the node exporter, your node stats will be available on `mash.example.com/metrics/node-exporter` with basic auth credentials you configured -To integrate Prometheus Node Exporter with a locally installed [Prometheus](prometheus.md) service, see the [Integrating with Prometheus Node Exporter](prometheus.md#integrating-with-prometheus-node-exporter) section of the documentation. +To integrate Prometheus Node Exporter with a [Prometheus](prometheus.md) instance, see the [Integrating with Prometheus Node Exporter](prometheus.md#integrating-with-prometheus-node-exporter) section of the documentation. diff --git a/group_vars/mash_servers b/group_vars/mash_servers index 5989aca..7fe108c 100644 --- a/group_vars/mash_servers +++ b/group_vars/mash_servers @@ -805,7 +805,7 @@ prometheus_node_exporter_base_path: "{{ mash_playbook_base_path }}/prometheus-no prometheus_node_exporter_uid: "{{ mash_playbook_uid }}" prometheus_node_exporter_gid: "{{ mash_playbook_gid }}" -prometheus_node_exporter_basicauth_enabled: true +prometheus_node_exporter_basicauth_enabled: "{{ prometheus_node_exporter_container_labels_traefik_enabled }}" prometheus_node_exporter_basicauth_user: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'node.user', rounds=655555) | to_uuid }}" prometheus_node_exporter_basicauth_password: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'node.password', rounds=655555) | to_uuid }}" @@ -814,7 +814,8 @@ prometheus_node_exporter_container_additional_networks: | ([mash_playbook_reverse_proxyable_services_additional_network] if mash_playbook_reverse_proxyable_services_additional_network else []) }} -prometheus_node_exporter_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled }}" +# Only enable Traefik labels if a hostname is set (indicating that this will be exposed publicly) +prometheus_node_exporter_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled and prometheus_node_exporter_hostname }}" prometheus_node_exporter_container_labels_traefik_docker_network: "{{ mash_playbook_reverse_proxyable_services_additional_network }}" prometheus_node_exporter_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}" prometheus_node_exporter_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}" diff --git a/requirements.yml b/requirements.yml index d7b3abc..baa5b4a 100644 --- a/requirements.yml +++ b/requirements.yml @@ -64,7 +64,7 @@ version: v7.0.9-0 - src: git+https://gitlab.com/etke.cc/roles/prometheus_node_exporter.git - version: v1.5.0-4 + version: v1.5.0-6 - src: git+https://gitlab.com/etke.cc/roles/prometheus_blackbox_exporter.git version: v0.23.0-1