cadvisor metrics

groundcover generates Infrastructure metrics out of the box, covering common use cases for monitoring the health of your services. This is done without relying on any existing services such as cadvisor or node-exporter.

However certain use-cases such as importing existing dashboards and alerts require scraping additional metrics, which can be scraped using our custom metrics integration.

Scraping cadvisor metrics in kubernetes

cadvisor metrics can be automatically scraped into groundcover using the following configuration.

In order to limit cardinality, the configuration below only scrapes the container_cpu_usage_seconds_total and container_memory_working_set_bytes metrics. Editing the regex part will control which metrics are being scraped into groundcover.

custom-metrics:
  enabled: true
  extraScrapeConfigs:
    - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
      job_name: kubernetes-nodes-cadvisor
      scrape_interval: 1m
      kubernetes_sd_configs:
        - role: node
      relabel_configs:
        - action: labelmap
          regex: __meta_kubernetes_node_label_(.+)
        - replacement: kubernetes.default.svc:443
          target_label: __address__
        - regex: (.+)
          replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
          source_labels:
            - __meta_kubernetes_node_name
          target_label: __metrics_path__
      scheme: https
      tls_config:
        ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        insecure_skip_verify: true
      metric_relabel_configs:
      - source_labels: [__name__]
        action: keep
        regex: '(container_cpu_usage_seconds_total|container_memory_working_set_bytes)'

Last updated