Skip to content

Commit 8366faa

Browse files
committed
fix: domains is now just fqdn and fqdn:port
* add the https directly in the label config in prom * removed the static https setting in the respective class * reverted the certname for host one, since it will create problem in multiple places like the alert needs to depends on the certname, which will have the client certname (exported one) ``` probe_ssl_earliest_cert_expiry - time() < on (certname, domain) 86400 * threshold::monitor::domains::cert_expiry_days and on (certname) obmondo_monitoring{alert_id="monitor::domains::cert_expiry"} > 0 ```
1 parent 042b295 commit 8366faa

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

modules/enableit/common/data/common.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ common::monitor::prometheus::server::collect_scrape_jobs:
367367
target_label: domain
368368
- source_labels: [__address__]
369369
target_label: __param_target
370+
replacement: https://$1/
370371
- source_labels: [__param_target]
371372
target_label: instance
372373
- target_label: __address__

modules/enableit/common/manifests/monitor/exporter/blackbox.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#
55
# @param listen_port The port on which the exporter listens.
66
#
7-
# @param noop_value Eit_types::Noop_Value to indicate if operations should be in noop mode. Defaults to $common::monitor::exporter::noop_value.
7+
# @param noop_value Eit_types::Noop_Value to indicate if operations should be in noop mode.
8+
# Defaults to $common::monitor::exporter::noop_value.
89
#
910
# @param config_file The absolute path to the configuration file. Defaults to "${common::monitor::exporter::config_dir}/blackbox.yml".
1011
#

modules/enableit/eit_types/types/monitor/domains.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
type Eit_types::Monitor::Domains = Variant[
33
Eit_types::FQDNPort,
44
Stdlib::Fqdn,
5-
Stdlib::HttpUrl
65
]

modules/enableit/monitor/manifests/domains.pp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99
# @groups monitoring enable, expiry_days, domain
1010
#
1111
define monitor::domains (
12-
Boolean $enable = true,
13-
Integer[1,25] $expiry_days = 25,
14-
Eit_types::Monitor::Domains $domain = $title,
12+
Boolean $enable = true,
13+
Integer[1,25] $expiry_days = 25,
14+
Eit_types::Monitor::Domains $domain = $title,
1515
) {
1616

1717
include monitor::domains::health
1818

1919
$job_name = 'probe_blackbox_domains'
2020
$collect_dir = '/etc/prometheus/file_sd_config.d'
21-
$_domain = regsubst($domain, '^(https?://)?([^/]+)(/.*)?$', '\2', 'G').split('/')[0]
2221

23-
@@prometheus::scrape_job { $_domain :
22+
@@prometheus::scrape_job { $domain :
2423
job_name => $job_name,
2524
tag => [
2625
$trusted['certname'],
@@ -35,17 +34,17 @@
3534
$blackbox_node = if $enable { lookup('common::monitor::exporter::blackbox::node') }
3635
# NOTE: skip deleting the files on the actual blackbox node
3736
if $blackbox_node != $trusted['certname'] {
38-
File <| title == "${collect_dir}/${job_name}_${_domain}.yaml" |> {
37+
File <| title == "${collect_dir}/${job_name}_${domain}.yaml" |> {
3938
ensure => absent
4039
}
4140
}
4241

43-
@@monitor::threshold { "monitor::domains::expiry::${_domain}" :
42+
@@monitor::threshold { "monitor::domains::expiry::${domain}" :
4443
enable => $enable,
4544
record => 'monitor::domains::cert_expiry_days',
4645
tag => $trusted['certname'],
4746
labels => {
48-
'domain' => $_domain,
47+
'domain' => $domain,
4948
},
5049
expr => $expiry_days,
5150
}

modules/enableit/profile/manifests/certs/manual.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
} else {
7676
$ports.each |$port| {
7777
monitor::domains { "${_domain}_${port}":
78-
domain => "https://${_domain}:${port}",
78+
domain => "${_domain}:${port}",
7979
}
8080
}
8181
}

modules/enableit/profile/manifests/web/apache.pp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,16 @@
109109
if ! $params['domains'].empty {
110110
$params['domains'].map |$domain| {
111111
monitor::domains { "${domain}_${params['port']}":
112-
domain => "https://${domain}:${params['port']}",
112+
domain => "${domain}:${params['port']}",
113113
}
114114
}
115115
} elsif ! $domains.empty {
116116
$domains.map |$domain| {
117-
monitor::domains { $domain:
118-
domain => "https://${domain}",
119-
}
117+
monitor::domains { $domain: }
120118
}
121119
} else {
122120
$domain = extract_common_name($params['ssl_cert'])
123-
monitor::domains { $domain:
124-
domain => "https://${domain}",
125-
}
121+
monitor::domains { $domain: }
126122
}
127123
}
128124

0 commit comments

Comments
 (0)