2025-06-13 14:33:21 +02:00
|
|
|
# prometheus_cd::params.pp
|
|
|
|
|
# Module name: prometheus_cd
|
|
|
|
|
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
|
|
|
|
# @summary Class holds all parameters for the prometheus_cd module.
|
2025-06-13 15:26:50 +02:00
|
|
|
# @param [String] reqpackage_prom the prometheus package
|
|
|
|
|
# @param [String] reqpackage_ne the node_exporter package
|
|
|
|
|
# @param [String] pkg_ensure which version of the package to install
|
|
|
|
|
# @param [boolean] manage_prometheus whether to manage prometheus
|
|
|
|
|
# @param [boolean] manage_node_exporter whether to manage node exporter
|
2025-10-18 12:30:47 +02:00
|
|
|
# @param [boolean] ps_manage_fw whether to manage the firewall
|
|
|
|
|
# @param [String] ps_prom_host the fqdn of the prometheus server
|
|
|
|
|
# @param [String] ps_fw_prefix the firewall rule prefix
|
|
|
|
|
# @param [String] ps_main_port the firewall main port for prometheus
|
2025-10-18 13:08:50 +02:00
|
|
|
# @param [String] ps_auth_user the username for authentication
|
2025-10-18 13:59:28 +02:00
|
|
|
# @param [String] ps_auth_pass the password for authentication
|
2025-10-18 16:30:54 +02:00
|
|
|
# @param [String] ps_web_pass the password for web authentication
|
2025-10-18 15:47:20 +02:00
|
|
|
# @param [String] ps_retention_time tsdb retention time
|
|
|
|
|
# @param [String] ps_retention_size tsdb retention size
|
2025-10-18 17:33:33 +02:00
|
|
|
# @param [String] ps_wal_seg_size WAL segment size
|
2025-12-03 12:37:30 +01:00
|
|
|
# @param [String] ps_min_block_dur tsdb minimum block duration
|
|
|
|
|
# @param [String] ps_max_block_dur tsdb maximum block duration
|
2025-12-03 12:24:44 +01:00
|
|
|
# @param [String] ps_max_mem hard memory ceiling
|
|
|
|
|
# @param [String] ps_high_mem soft limit to make kernel reclaim earlier
|
|
|
|
|
# @param [String] ps_swap_mem allow swap, but limit it
|
|
|
|
|
# @param [String] ps_oom_score OOM killer choosing prometheus
|
2025-12-03 15:29:56 +01:00
|
|
|
# @param [String] ps_max_procs reduce parallel WAL replay workers
|
|
|
|
|
# @param [Boolean] ps_write_external whether to allow remote postgres
|
|
|
|
|
# @param [String] ps_auth_ext_user user for writing to extern instance
|
|
|
|
|
# @param [String] ps_auth_ext_pass password for writing to extern instance
|
|
|
|
|
# @param [String] ps_external_url the full url for the remote write point
|
2025-06-13 14:33:21 +02:00
|
|
|
##############################################################################
|
2025-06-13 14:37:00 +02:00
|
|
|
class prometheus_cd::params (
|
2025-10-17 17:21:26 +02:00
|
|
|
|
2025-10-18 12:30:47 +02:00
|
|
|
# installation
|
2025-10-18 10:54:17 +02:00
|
|
|
String $reqpackage_prom = 'prometheus2',
|
2025-06-13 15:26:50 +02:00
|
|
|
String $reqpackage_ne = 'node_exporter',
|
|
|
|
|
String $pkg_ensure = 'present',
|
2025-10-18 12:30:47 +02:00
|
|
|
|
|
|
|
|
# config logic
|
2025-06-13 15:26:50 +02:00
|
|
|
Boolean $manage_prometheus = false,
|
|
|
|
|
Boolean $manage_node_exporter = false,
|
2025-10-18 12:30:47 +02:00
|
|
|
Boolean $ps_manage_fw = false,
|
|
|
|
|
String $ps_prom_host = 'prometheus.example.net',
|
|
|
|
|
|
|
|
|
|
# firewall
|
|
|
|
|
String $ps_fw_prefix = '50',
|
|
|
|
|
String $ps_main_port = '9090',
|
2025-06-13 14:33:21 +02:00
|
|
|
|
2025-12-03 15:29:56 +01:00
|
|
|
# auth prometheus
|
2025-10-18 13:08:50 +02:00
|
|
|
String $ps_auth_user = 'changeme',
|
|
|
|
|
String $ps_auth_pass = 'changeme',
|
2025-10-18 16:30:54 +02:00
|
|
|
String $ps_web_pass = 'changeme',
|
2025-10-18 13:08:50 +02:00
|
|
|
|
2025-12-03 15:29:56 +01:00
|
|
|
# auth remote
|
|
|
|
|
String $ps_auth_ext_user = 'changeme',
|
|
|
|
|
String $ps_auth_ext_pass = 'changeme',
|
|
|
|
|
|
2025-10-18 15:47:20 +02:00
|
|
|
# storage
|
|
|
|
|
String $ps_retention_time = '15d',
|
|
|
|
|
String $ps_retention_size = '20GB',
|
2025-10-18 17:33:33 +02:00
|
|
|
String $ps_wal_seg_size = '50MB',
|
2025-12-03 12:37:30 +01:00
|
|
|
String $ps_min_block_dur = '2h',
|
|
|
|
|
String $ps_max_block_dur = '2h',
|
2025-10-18 15:47:20 +02:00
|
|
|
|
2025-12-03 12:24:44 +01:00
|
|
|
# service
|
|
|
|
|
String $ps_max_mem = '6G',
|
|
|
|
|
String $ps_high_mem = '5G',
|
|
|
|
|
String $ps_swap_mem = '4G',
|
|
|
|
|
String $ps_oom_score = '500',
|
|
|
|
|
String $ps_max_procs = '1',
|
|
|
|
|
|
2025-12-03 15:29:56 +01:00
|
|
|
# remote write external
|
|
|
|
|
Boolean $ps_write_external = false,
|
|
|
|
|
String $ps_external_url = 'http://change.local',
|
|
|
|
|
|
2025-06-13 14:33:21 +02:00
|
|
|
) {
|
2025-06-13 15:42:26 +02:00
|
|
|
# defaults
|
|
|
|
|
$fqdn = $facts['networking']['fqdn']
|
|
|
|
|
$domain = $facts['networking']['domain']
|
|
|
|
|
$os_name = $facts['os']['name']
|
|
|
|
|
$os_release = $facts['os']['release']['major']
|
|
|
|
|
|
2025-10-18 12:30:47 +02:00
|
|
|
# dirs
|
|
|
|
|
$ps_main_dir = '/etc/prometheus'
|
2025-10-18 15:29:20 +02:00
|
|
|
$ps_system_file_dir = '/etc/systemd/system/prometheus.service.d'
|
2025-10-18 12:30:47 +02:00
|
|
|
|
2025-10-18 13:08:50 +02:00
|
|
|
# files
|
2025-10-18 13:30:21 +02:00
|
|
|
$ps_main_file = "${ps_main_dir}/prometheus.yml"
|
2025-10-18 16:30:54 +02:00
|
|
|
$ps_web_config_file = "${ps_main_dir}/web.yml"
|
2025-10-18 15:29:20 +02:00
|
|
|
$ps_system_service_file = "${ps_system_file_dir}/override.conf"
|
2025-10-18 13:08:50 +02:00
|
|
|
|
|
|
|
|
# services
|
|
|
|
|
$ps_prom_service = 'prometheus'
|
|
|
|
|
$ps_ne_service = 'node_exporter'
|
2025-10-18 13:59:28 +02:00
|
|
|
|
2025-06-13 14:33:21 +02:00
|
|
|
# includes must be last
|
|
|
|
|
include prometheus_cd::main::config
|
|
|
|
|
}
|