How do we export cadvisor metrics in prometheus

11/28/2018

I am using Cadvisor to get kubernetes stats for container and it is running fine for me on port 8080 . Now i need to export these metrics in prometheus , https://github.com/google/cadvisor/blob/master/docs/storage/README.md

Above link specify that cadvisor provides prometheus as a storage driver .

Can someone consolidate these steps to me?

-- MAG
cadvisor
kubernetes
prometheus

1 Answer

11/29/2018

Just tell Prometheus to scrape the "/metrics" endpoint of the cAdvisor server. This is my scrape config for my cAdvisor instance:

scrape_configs:
- job_name: cadvisor
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - cadvisor:8080
  relabel_configs:
  - separator: ;
    regex: (.*)
    target_label: instance
    replacement: cadvisor
    action: replace
-- wbh1
Source: StackOverflow