From 96211f2eb5bee4f65150ac6841bd9f356e52515a Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Tue, 1 Sep 2026 11:06:14 +0200 Subject: [PATCH] OP#662 add flags to params --- README.md | 1 - manifests/params.pp | 29 +++++++++++++++-------------- templates/config.alloy.erb | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6de54b9..3bac112 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Then you can use Grafana itself to visualize those logs and metrics and built an INSTALLATION - installs alloy binaries -- installs node exporter (optional, set `ay_manage_ne`to `true`) CONFIGURATION diff --git a/manifests/params.pp b/manifests/params.pp index ab09ab1..f2ef870 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,30 +8,31 @@ # @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 +# @param [Boolean] ay_prom_honor_timestamps whether to honor +# timestamps in prometheus metrics +# @param [Boolean] ay_prom_track_timestamps_staleness whether to track timestamps +# staleness in prometheus metrics # @summary Class contains all parameters for the confdroid_alloy module. ############################################################################## class confdroid_alloy::params ( - String $ay_reqpackages = 'alloy', - String $ay_pkg_ensure = 'latest', + String $ay_reqpackages = 'alloy', + String $ay_pkg_ensure = 'latest', # loki - Boolean $ay_manage_loki = true, - String $ay_loki_url = 'https://loki.example.net/loki/api/v1/push', - String $ay_loki_username = 'loki_user', - String $ay_loki_userpass = 'loki_pass', - Array $ay_log_targets = ['/var/log/messages','/var/log/secure',], + Boolean $ay_manage_loki = true, + String $ay_loki_url = 'https://loki.example.net/loki/api/v1/push', + String $ay_loki_username = 'loki_user', + String $ay_loki_userpass = 'loki_pass', + Array $ay_log_targets = ['/var/log/messages','/var/log/secure',], # prometheus - Boolean $ay_manage_prom = true, - String $ay_prom_url = 'https://prometheus.example.net/api/v1/write', - -# node exporter (external) - Boolean $ay_manage_ne = false, + Boolean $ay_manage_prom = true, + String $ay_prom_url = 'https://prometheus.example.net/api/v1/write', + Boolean $ay_prom_honor_timestamps = true, + Boolean $ay_prom_track_timestamps_staleness = true, ) { # service diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index 2208222..2bccb68 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -79,8 +79,8 @@ prometheus.scrape "node_exporter" { targets = discovery.relabel.node_exporter.output forward_to = [prometheus.remote_write.prometheus.receiver] scrape_interval = "15s" - honor_timestamps = true - track_timestamps_staleness = true + honor_timestamps = <%= @ay_prom_honor_timestamps %> + track_timestamps_staleness = <%= @ay_prom_track_timestamps_staleness %> } prometheus.remote_write "prometheus" {