Skip to content

Commit e98d890

Browse files
authored
Update prometheus with thanos configuration (#237)
1 parent 90fdbf2 commit e98d890

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

modules/prometheus.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ def requires(host, *args):
169169

170170

171171
def generate(host, *args):
172+
current_event = lib.get_current_event()
173+
172174
info = {}
173175
local_targets = []
174176
local_targets.append({
175177
'job_name': 'prometheus',
176178
'scheme': 'http',
177179
'static_configs': [{'targets': ['localhost:9090']}]})
178180
info['prometheus'] = generate_backend(host, local_targets)
181+
info['current_event'] = current_event
179182

180183
return info
181184

modules/prometheus/manifests/init.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# [*scrape_configs*]
1313
# Map of the same structure as Prometheus' scrape_configs.
1414
#
15+
# [*current_event*]
16+
# The current event name, e.g. dhs19
17+
#
1518

16-
class prometheus ($scrape_configs) {
19+
class prometheus ($scrape_configs, $current_event = '') {
1720

1821
#Create user/group for Prometheus
1922
group { 'prometheus':

modules/prometheus/templates/prometheus.yaml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
'global' => {
33
'scrape_interval' => '30s',
44
'scrape_timeout' => '25s',
5+
'external_labels' => {
6+
'cluster' => 'event-@current_event'
7+
}
58
},
69
'rule_files' => [
710
'/opt/prometheus/rules/*.prom.yml',

0 commit comments

Comments
 (0)