Split infra and workload monitoring for K8S

This change allows to enable the monitoring only for the K8S
infrastructure (default) or for both the infrastructure and the
workloads running on top of K8S.

Change-Id: Idc68576f2d64840c0454fadc204174027bbaa454
This commit is contained in:
Simon Pasquier 2017-07-19 11:42:11 +02:00
parent 3b4ad1fb29
commit 1ac10079c9

View file

@ -98,6 +98,7 @@ scrape_configs:
{%- if server.get('target', {}).get('kubernetes', {}).get('enabled', False) %} {%- if server.get('target', {}).get('kubernetes', {}).get('enabled', False) %}
{%- set kubernetes_target = server.target.kubernetes %} {%- set kubernetes_target = server.target.kubernetes %}
- job_name: 'kubernetes-api' - job_name: 'kubernetes-api'
scheme: https scheme: https
tls_config: tls_config:
@ -116,7 +117,6 @@ scrape_configs:
action: keep action: keep
regex: default;kubernetes;https regex: default;kubernetes;https
- job_name: 'kubernetes-node' - job_name: 'kubernetes-node'
scheme: https scheme: https
tls_config: tls_config:
@ -134,7 +134,7 @@ scrape_configs:
- action: labelmap - action: labelmap
regex: __meta_kubernetes_node_label_(.+) regex: __meta_kubernetes_node_label_(.+)
{%- if kubernetes_target.get('endpoint', {}).get('enabled') %}
- job_name: 'kubernetes-service-endpoints' - job_name: 'kubernetes-service-endpoints'
scheme: https scheme: https
tls_config: tls_config:
@ -179,8 +179,9 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_name] - source_labels: [__meta_kubernetes_pod_name]
action: replace action: replace
target_label: kubernetes_pod_name target_label: kubernetes_pod_name
{%- endif %}
{%- if kubernetes_target.get('pod', {}).get('enabled') %}
- job_name: 'kubernetes-pod' - job_name: 'kubernetes-pod'
scheme: https scheme: https
tls_config: tls_config:
@ -216,6 +217,7 @@ scrape_configs:
action: replace action: replace
target_label: kubernetes_pod_name target_label: kubernetes_pod_name
{%- endif %} {%- endif %}
{%- endif %}
{%- if server.get('target', {}).get('dns', {}).get('enabled', False) %} {%- if server.get('target', {}).get('dns', {}).get('enabled', False) %}
{%- for target in server.get('target', {}).get('dns', {}).get('endpoint', []) %} {%- for target in server.get('target', {}).get('dns', {}).get('endpoint', []) %}