From 7a1749a73803ebc35420ffdba1b4fe87942fa30a Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Fri, 13 Jun 2025 16:05:16 +0200 Subject: [PATCH 1/2] add option to include node exporter --- manifests/main/yumrepo.pp | 1 - manifests/params.pp | 5 +++++ templates/config.alloy.erb | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/manifests/main/yumrepo.pp b/manifests/main/yumrepo.pp index b2f63d4..925cc53 100644 --- a/manifests/main/yumrepo.pp +++ b/manifests/main/yumrepo.pp @@ -6,7 +6,6 @@ class alloy_cd::main::yumrepo ( ) inherits alloy_cd::params { - # test yumrepo { 'grafana': ensure => 'present', diff --git a/manifests/params.pp b/manifests/params.pp index 00a101b..e4030a7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,6 +8,8 @@ # @param [String] ay_loki_userpass the password to logon to loki # @param [Boolean] ay_manage_loki whether to manage log forwarding to loki # @param [Boolean] ay_manage_prom whether to manage metric forwarding +# @param [Boolean] ay_manage_ne whether to manage metric forwarding for +# the node exporter (external) # @param [String] ay_prom_url the url where alloy will send metrics # @param [Array] ay_log_targets the logging targets # @summary Class contains all parameters for the alloy_cd module. @@ -28,6 +30,9 @@ class alloy_cd::params ( Boolean $ay_manage_prom = true, String $ay_prom_url = 'https://prometheus.example.net/api/v1/write', +# node exporter (external) + Boolean $ay_manage_ne = false, + ) { # service $ay_service = 'alloy' diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index 49e4e2e..6518c5f 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -64,7 +64,15 @@ prometheus.scrape "scrape_system" { forward_to = [prometheus.remote_write.prometheus.receiver] scrape_interval = "15s" } - +<% if @ay_manage_ne == true -%> +prometheus.scrape "node_exporter" { + targets = [ + { __address__ = "localhost:9100" },) + ] + forward_to = [prometheus.remote_write.prometheus.receiver] + scrape_interval = "15s" +} +<% end %> prometheus.remote_write "prometheus" { endpoint { url = "<%= @ay_prom_url %>" From 7973d1ec9639d21802407e1f958c42397ecc77ec Mon Sep 17 00:00:00 2001 From: Jenkins Server Date: Fri, 13 Jun 2025 16:06:24 +0200 Subject: [PATCH 2/2] Recommit for updates in build 6 --- .../alloy_cd_3A_3Amain_3A_3Ayumrepo.html | 4 +-- doc/puppet_classes/alloy_cd_3A_3Aparams.html | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/doc/puppet_classes/alloy_cd_3A_3Amain_3A_3Ayumrepo.html b/doc/puppet_classes/alloy_cd_3A_3Amain_3A_3Ayumrepo.html index 38016c0..7ba8e32 100644 --- a/doc/puppet_classes/alloy_cd_3A_3Amain_3A_3Ayumrepo.html +++ b/doc/puppet_classes/alloy_cd_3A_3Amain_3A_3Ayumrepo.html @@ -115,8 +115,7 @@ 17 18 19 -20 -21 +20
# File 'manifests/main/yumrepo.pp', line 6
@@ -124,7 +123,6 @@
 class alloy_cd::main::yumrepo (
 
 ) inherits alloy_cd::params {
-
   # test
   yumrepo { 'grafana':
     ensure   => 'present',
diff --git a/doc/puppet_classes/alloy_cd_3A_3Aparams.html b/doc/puppet_classes/alloy_cd_3A_3Aparams.html
index 27ab653..2b0919b 100644
--- a/doc/puppet_classes/alloy_cd_3A_3Aparams.html
+++ b/doc/puppet_classes/alloy_cd_3A_3Aparams.html
@@ -234,6 +234,24 @@
       
     
   
+    
  • + + ay_manage_ne + + + (Boolean) + + + (defaults to: false) + + + — +
    +

    whether to manage metric forwarding for the node exporter (external)

    +
    + +
  • +
  • ay_prom_url @@ -281,8 +299,6 @@
     
     
    -15
    -16
     17
     18
     19
    @@ -309,10 +325,15 @@
     40
     41
     42
    -43
    +43 +44 +45 +46 +47 +48
  • -
    # File 'manifests/params.pp', line 15
    +        
    # File 'manifests/params.pp', line 17
     
     class alloy_cd::params (
     
    @@ -330,6 +351,9 @@ class alloy_cd::params (
       Boolean $ay_manage_prom     = true,
       String $ay_prom_url         = 'https://prometheus.example.net/api/v1/write',
     
    +# node exporter (external)
    +  Boolean $ay_manage_ne       = false,
    +
     ) {
       # service
       $ay_service         = 'alloy'