From 791dfea63286a3f8cd23f8058c788c26fc25f99c Mon Sep 17 00:00:00 2001 From: makefunstuff Date: Fri, 28 Jun 2024 20:40:46 +0300 Subject: more metrics --- tools/monitoring/values.yaml | 116 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 5 deletions(-) (limited to 'tools/monitoring') diff --git a/tools/monitoring/values.yaml b/tools/monitoring/values.yaml index dad522e..6ccc866 100644 --- a/tools/monitoring/values.yaml +++ b/tools/monitoring/values.yaml @@ -34,7 +34,7 @@ grafana: jsonData: esVersion: 7 timeField: "@timestamp" - + prometheus: alertmanager: enabled: true @@ -42,6 +42,100 @@ prometheus: enabled: true server: enabled: true + extraScrapeConfigs: + - job_name: 'kubernetes-pods' + kubernetes_sd_configs: + - role: pod + relabel_configs: + - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] + action: keep + regex: true + - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] + action: replace + target_label: __metrics_path__ + regex: (.+) + - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] + action: replace + target_label: __address__ + regex: ([^:]+)(?::\d+)?;(\d+) + replacement: $1:$2 + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - source_labels: [__meta_kubernetes_namespace] + action: replace + target_label: kubernetes_namespace + - source_labels: [__meta_kubernetes_pod_name] + action: replace + target_label: kubernetes_pod_name + + - job_name: 'kubernetes-nodes' + kubernetes_sd_configs: + - role: node + relabel_configs: + - action: labelmap + regex: __meta_kubernetes_node_label_(.+) + + - job_name: 'kubernetes-apiservers' + kubernetes_sd_configs: + - role: endpoints + namespaces: + names: + - default + relabel_configs: + - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] + action: keep + regex: default;kubernetes;https + + - job_name: 'kubernetes-cadvisor' + kubernetes_sd_configs: + - role: node + scheme: https + tls_config: + ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + insecure_skip_verify: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + relabel_configs: + - action: labelmap + regex: __meta_kubernetes_node_label_(.+) + - target_label: __address__ + replacement: kubernetes.default.svc:443 + - source_labels: [__meta_kubernetes_node_name] + regex: (.+) + target_label: node + - source_labels: [__meta_kubernetes_node_name] + regex: (.+) + target_label: instance + - target_label: __metrics_path__ + replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor + + - job_name: 'kubernetes-service-endpoints' + kubernetes_sd_configs: + - role: endpoints + relabel_configs: + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] + action: keep + regex: true + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] + action: replace + target_label: __scheme__ + regex: (https?) + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] + action: replace + target_label: __metrics_path__ + regex: (.+) + - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] + action: replace + target_label: __address__ + regex: ([^:]+)(?::\d+)?;(\d+) + replacement: $1:$2 + - action: labelmap + regex: __meta_kubernetes_service_label_(.+) + - source_labels: [__meta_kubernetes_namespace] + action: replace + target_label: kubernetes_namespace + - source_labels: [__meta_kubernetes_service_name] + action: replace + target_label: kubernetes_name elasticsearch: volumeClaimTemplate: @@ -61,13 +155,26 @@ opentelemetry-collector: protocols: grpc: {} http: {} + k8s_logs: + operators: + - type: extract + config: + from: kubernetes.annotations processors: batch: {} + resource: + attributes: + - key: k8s.pod.name + from_attribute: k8s.pod.uid + - key: k8s.namespace.name + from_attribute: k8s.namespace.uid exporters: prometheusremotewrite: endpoint: "http://prometheus-server.monitoring.svc.cluster.local/api/v1/write" logging: loglevel: debug + otlphttp: + endpoint: "http://elasticsearch-master.monitoring.svc.cluster.local:9200" service: pipelines: metrics: @@ -75,7 +182,6 @@ opentelemetry-collector: processors: [batch] exporters: [prometheusremotewrite] logs: - receivers: [otlp] - processors: [batch] - exporters: [logging] - + receivers: [otlp, k8s_logs] + processors: [batch, resource] + exporters: [logging, otlphttp] -- cgit 1.4.1-2-gfad0