1
0
mirror of https://github.com/lensapp/lens.git synced 2024-09-20 13:57:23 +03:00
lens/jsonnet/custom-prometheus.jsonnet
Jetchko Jekov ec392c3828
Fix serviceMonitorKubelet's metricRelabelings (#225)
Signed-off-by: Jetchko Jekov <jetchko.jekov@gmail.com>
2020-04-10 11:05:18 +03:00

49 lines
1.2 KiB
Plaintext

{
// Add Lens metric relabelings for custom prometheus instances installed with kube-prometheus
// https://github.com/lensapp/lens/blob/master/troubleshooting/custom-prometheus.md
nodeExporter+:: {
serviceMonitor+: {
spec+: {
endpoints: std.map(function(endpoint)
if endpoint.port == "https" then
endpoint {
relabelings+: [
{
action: 'replace',
regex: '(.*)',
replacement: '$1',
sourceLabels: ['__meta_kubernetes_pod_node_name'],
targetLabel: 'kubernetes_node',
}
],
}
else
endpoint,
super.endpoints
),
},
},
},
prometheus+:: {
serviceMonitorKubelet+: {
spec+: {
endpoints: std.map(function(endpoint)
if endpoint.port == "https-metrics" then
endpoint {
metricRelabelings+: [
{
action: 'replace',
sourceLabels: ['node'],
targetLabel: 'instance',
},
],
}
else
endpoint,
super.endpoints
),
},
},
},
}