Merge pull request #77 from grafana/filter_cadvisor_kubelet_metrics_on_namespace
Only get cadvisor and kubelet metrics from the required namespaces
This commit is contained in:
commit
be7a32de27
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
production/
|
.DS_Store
|
||||||
|
production/
|
||||||
|
@ -6,6 +6,15 @@
|
|||||||
{{- join ", " $list }}
|
{{- join ", " $list }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "agent.all_namespaces" -}}
|
||||||
|
{{- $list := list }}
|
||||||
|
{{- range .Values.namespacesToMonitor }}
|
||||||
|
{{- $list = append $list (printf "\"%s\"" .) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $list = append $list .Release.Namespace }}
|
||||||
|
{{- join "|" $list }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "agent.loki_write_targets" -}}
|
{{- define "agent.loki_write_targets" -}}
|
||||||
{{- $list := list }}
|
{{- $list := list }}
|
||||||
{{- if .Values.local.logs.enabled }}
|
{{- if .Values.local.logs.enabled }}
|
||||||
|
@ -137,6 +137,13 @@ data:
|
|||||||
action = "keep"
|
action = "keep"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rule {
|
||||||
|
source_labels = ["namespace"]
|
||||||
|
regex = "{{ include "agent.all_namespaces" . }}""
|
||||||
|
|
||||||
|
action = "keep"
|
||||||
|
}
|
||||||
|
|
||||||
forward_to = [ {{ include "agent.prometheus_write_targets" . }} ]
|
forward_to = [ {{ include "agent.prometheus_write_targets" . }} ]
|
||||||
}
|
}
|
||||||
{{- if .Values.kubeStateMetrics.enabled }}
|
{{- if .Values.kubeStateMetrics.enabled }}
|
||||||
@ -154,6 +161,10 @@ data:
|
|||||||
// Based on https://github.com/Chewie/loutretelecom-manifests/blob/main/manifests/addons/monitoring/config.river
|
// Based on https://github.com/Chewie/loutretelecom-manifests/blob/main/manifests/addons/monitoring/config.river
|
||||||
discovery.kubernetes "all_nodes" {
|
discovery.kubernetes "all_nodes" {
|
||||||
role = "node"
|
role = "node"
|
||||||
|
namespaces {
|
||||||
|
own_namespace = true
|
||||||
|
names = [ {{ include "agent.namespaces" . }} ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
discovery.relabel "all_nodes" {
|
discovery.relabel "all_nodes" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user