Puppet Class: prometheus_cd::params

Summary

Class holds all parameters for the prometheus_cd module.

Overview

prometheus_cd::params.pp Module name: prometheus_cd Author: Arne Teuke (arne_teuke@confdroid.com)

Parameters:

  • reqpackage_prom (String) (defaults to: 'prometheus2')

    the prometheus package

  • reqpackage_ne (String) (defaults to: 'node_exporter')

    the node_exporter package

  • pkg_ensure (String) (defaults to: 'present')

    which version of the package to install

  • manage_prometheus (Boolean) (defaults to: false)

    whether to manage prometheus

  • manage_node_exporter (Boolean) (defaults to: false)

    whether to manage node exporter

  • ps_manage_fw (Boolean) (defaults to: false)

    whether to manage the firewall

  • ps_prom_host (String) (defaults to: 'prometheus.example.net')

    the fqdn of the prometheus server

  • ps_fw_prefix (String) (defaults to: '50')

    the firewall rule prefix

  • ps_main_port (String) (defaults to: '9090')

    the firewall main port for prometheus

  • ps_auth_user (String) (defaults to: 'changeme')

    the username for authentication

  • ps_auth_pass (String) (defaults to: 'changeme')

    the password for authentication

  • ps_web_pass (String) (defaults to: 'changeme')

    the password for web authentication

  • ps_retention_time (String) (defaults to: '15d')

    tsdb retention time

  • ps_retention_size (String) (defaults to: '20GB')

    tsdb retention size

  • ps_wal_seg_size (String) (defaults to: '50MB')

    WAL segment size

  • ps_min_block_dur (String) (defaults to: '2h')

    tsdb minimum block duration

  • ps_max_block_dur (String) (defaults to: '2h')

    tsdb maximum block duration

  • ps_max_mem (String) (defaults to: '6G')

    hard memory ceiling

  • ps_high_mem (String) (defaults to: '5G')

    soft limit to make kernel reclaim earlier

  • ps_swap_mem (String) (defaults to: '4G')

    allow swap, but limit it

  • ps_oom_score (String) (defaults to: '500')

    OOM killer choosing prometheus

  • ps_max_procs (String) (defaults to: '1')

    reduce parallel WAL replay workers

  • ps_write_external (Boolean) (defaults to: false)

    whether to allow remote postgres

  • ps_auth_ext_user (String) (defaults to: 'changeme')

    user for writing to extern instance

  • ps_auth_ext_pass (String) (defaults to: 'changeme')

    password for writing to extern instance

  • ps_external_url (String) (defaults to: 'http://changeme.local/write')

    the full url for the remote write point

  • ps_enable_pruning (Boolean) (defaults to: false)

    whether to allow pruning local blocks

  • ps_pruning_dir (String) (defaults to: '/opt/prometheus-prune')

    the directory for the pruning script

  • ps_pruning_file (String) (defaults to: "${ps_pruning_dir}/prune_prometheus_pg.sh")

    the url and filename for the pruning script

  • ps_env_file (String) (defaults to: "${ps_pruning_dir}/prune.env")

    the url and filename for the env file

  • ps_pg_host (String) (defaults to: 'localhost')

    the host running the database for cold metrics

  • ps_pg_port (String) (defaults to: '5432')

    the port for the database for cold metrics

  • ps_pg_db (String) (defaults to: 'prometheus')

    the database for cold metrics

  • ps_pg_user (String) (defaults to: 'readaccess')

    the read-only user for the db for cold metrics

  • ps_pg_pass (String) (defaults to: 'Changeme')

    the password for the db for cold metrics

  • ps_dry_run (Boolean) (defaults to: true)

    (true = just log, false = actually delete blocks)

  • ps_min_age_hours (String) (defaults to: '4')

    Minimum block age in hours before pruning

  • ps_grace_hours (String) (defaults to: '1')

    Grace period in hours to be extra safe



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'manifests/params.pp', line 44

class prometheus_cd::params (

  # installation
  String $reqpackage_prom       = 'prometheus2',
  String $reqpackage_ne         = 'node_exporter',
  String $pkg_ensure            = 'present',

  # config logic
  Boolean $manage_prometheus    = false,
  Boolean $manage_node_exporter = false,
  Boolean $ps_manage_fw         = false,
  String $ps_prom_host          = 'prometheus.example.net',

  # firewall
  String $ps_fw_prefix          = '50',
  String $ps_main_port          = '9090',

  # auth prometheus
  String $ps_auth_user          = 'changeme',
  String $ps_auth_pass          = 'changeme',
  String $ps_web_pass           = 'changeme',

  # auth remote
  String $ps_auth_ext_user      = 'changeme',
  String $ps_auth_ext_pass      = 'changeme',

  # storage
  String $ps_retention_time     = '15d',
  String $ps_retention_size     = '20GB',
  String $ps_wal_seg_size       = '50MB',
  String $ps_min_block_dur      = '2h',
  String $ps_max_block_dur      = '2h',

  # 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',

  # remote write external
  Boolean $ps_write_external    = false,
  String $ps_external_url       = 'http://changeme.local/write',

  # pruning script
  Boolean $ps_enable_pruning    = false,
  String $ps_pruning_dir        = '/opt/prometheus-prune',
  String $ps_pruning_file       = "${ps_pruning_dir}/prune_prometheus_pg.sh",
  String $ps_env_file           = "${ps_pruning_dir}/prune.env",
  String $ps_pg_host            = 'localhost',
  String $ps_pg_port            = '5432',
  String $ps_pg_db              = 'prometheus',
  String $ps_pg_user            = 'readaccess',
  String $ps_pg_pass            = 'Changeme',
  Boolean $ps_dry_run           = true,
  String $ps_min_age_hours      = '4',
  String $ps_grace_hours        = '1',

) {
  # defaults
  $fqdn                   = $facts['networking']['fqdn']
  $domain                 = $facts['networking']['domain']
  $os_name                = $facts['os']['name']
  $os_release             = $facts['os']['release']['major']

  # dirs
  $ps_main_dir            = '/etc/prometheus'
  $ps_system_file_dir     = '/etc/systemd/system/prometheus.service.d'
  $ps_system_dir          = '/etc/systemd/system/'

  # files
  $ps_main_file           = "${ps_main_dir}/prometheus.yml"
  $ps_web_config_file     = "${ps_main_dir}/web.yml"
  $ps_system_service_file = "${ps_system_file_dir}/override.conf"
  $ps_pruning_svc_file    = "${ps_system_dir}/prometheus-prune.service"
  $ps_pruning_timer_file  = "${ps_system_dir}/prometheus-prune.timer"
  $ps_prune_log_file      = '/var/log/prometheus-prune.log'

  # services
  $ps_prom_service        = 'prometheus'
  $ps_ne_service          = 'node_exporter'
  $ps_prune_service       = 'prometheus-prune.service'
  $ps_prune_timer         = 'prometheus-prune.timer'

  # includes must be last
  include prometheus_cd::main::config
}