-
Notifications
You must be signed in to change notification settings - Fork 160
/
prometheus-config.libsonnet
62 lines (54 loc) · 1.88 KB
/
prometheus-config.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local prometheus = import 'prometheus/prometheus.libsonnet';
local scrape_configs = import 'prometheus/scrape_configs.libsonnet';
{
prometheus_config:: {
global: {
scrape_interval: '15s',
},
rule_files: [
'alerts/alerts.rules',
'recording/recording.rules',
],
alerting: {
alertmanagers: prometheus.withAlertmanagers(
$._config.alertmanagers,
$._config.cluster_name
).prometheus_config.alerting.alertmanagers,
},
scrape_configs: [
// Grafana Labs' battle tested scrape config for scraping kubernetes pods.
scrape_configs.kubernetes_pods,
// kube-dns does not adhere to the conventions set out by
// `scrape_configs.kubernetes_pods`.
scrape_configs.kube_dns,
// This scrape config gathers all kubelet metrics.
scrape_configs.kubelet($._config.prometheus_api_server_address)
+ (
// Couldn't get prometheus to validate the kubelet cert for scraping, so
// don't bother for now.
if $._config.prometheus_insecure_skip_verify
then scrape_configs.insecureSkipVerify
else {}
),
// This scrape config gathers cAdvisor metrics.
scrape_configs.cadvisor($._config.prometheus_api_server_address)
+ (
if $._config.prometheus_insecure_skip_verify
then scrape_configs.insecureSkipVerify
else {}
),
// If running on GKE, you cannot scrape API server pods, and must instead
// scrape the API server service endpoints. On AKS this doesn't work.
(
if $._config.scrape_api_server_endpoints
then scrape_configs.kubernetes_api(role='endpoints') // GKE
else scrape_configs.kubernetes_api(role='service') // AKS et al.
)
+ (
if $._config.prometheus_insecure_skip_verify
then scrape_configs.insecureSkipVerify
else {}
),
],
},
}