-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathmixins.libsonnet
93 lines (82 loc) · 3.18 KB
/
mixins.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
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
{
// Add you mixins here.
mixins+:: {
base+: {
prometheusRules+::
{
groups+: [
{
// Add mapping from namespace, pod -> node with node name as pod, as
// we use the node name as the node-exporter instance label.
name: 'instance_override',
rules: [
{
record: 'node_namespace_pod:kube_pod_info:',
expr: |||
max by(node, namespace, instance) (
label_replace(kube_pod_info{job="%(kube_state_metrics_namespace)s/kube-state-metrics"}
, "instance", "$1", "node", "(.*)")
)
||| % $._config,
},
],
},
],
},
},
kubernetes:
(import 'kubernetes-mixin/mixin.libsonnet') {
grafanaDashboardFolder: 'Kubernetes',
_config+:: {
cadvisorSelector: 'job="kube-system/cadvisor"',
kubeletSelector: 'job="kube-system/kubelet"',
kubeStateMetricsSelector: 'job="%s/kube-state-metrics"' % $._config.kube_state_metrics_namespace,
nodeExporterSelector: 'job="%s/node-exporter"' % $._config.node_exporter_namespace, // Also used by node-mixin.
notKubeDnsSelector: 'job!="kube-system/kube-dns"',
kubeSchedulerSelector: 'job="kube-system/kube-scheduler"',
kubeControllerManagerSelector: 'job="kube-system/kube-controller-manager"',
kubeApiserverSelector: 'job="kube-system/kube-apiserver"',
podLabel: 'instance',
notKubeDnsCoreDnsSelector: 'job!~"kube-system/kube-dns|coredns"',
},
},
prometheus:
(import 'prometheus-mixin/mixin.libsonnet') {
grafanaDashboardFolder: 'Prometheus',
_config+:: {
prometheusSelector: 'job="default/prometheus"',
prometheusHAGroupLabels: 'job,cluster,namespace',
prometheusHAGroupName: '{{$labels.job}} in {{$labels.cluster}}',
},
},
alertmanager:
(import 'alertmanager-mixin/mixin.libsonnet') {
grafanaDashboardFolder: 'Alertmanager',
_config+:: {
alertmanagerSelector: 'job="default/alertmanager"',
alertmanagerClusterLabels: 'job, namespace',
alertmanagerName: '{{$labels.instance}} in {{$labels.cluster}}',
alertmanagerCriticalIntegrationsRegEx: @'pagerduty',
},
},
node_exporter:
(import 'node-mixin/mixin.libsonnet') {
grafanaDashboardFolder: 'node_exporter',
_config+:: {
nodeExporterSelector: 'job="%s/node-exporter"' % $._config.node_exporter_namespace, // Also used by node-mixin.
// Do not page if nodes run out of disk space.
nodeCriticalSeverity: 'warning',
grafanaPrefix: '/grafana',
},
},
// A more complete view than the node_exporter
node_exporter_full: {
grafanaDashboardFolder: 'node_exporter',
grafanaDashboards+:: {
'node-exporter-full.json': (import 'github.com/rfrail3/grafana-dashboards/prometheus/node-exporter-full.json'),
},
},
grafana:
(import 'grafana-mixin/mixin.libsonnet'),
},
}