Skip to content

Commit 63d8378

Browse files
eero-tPaweł Szulik
authored andcommitted
Add '-enable_metrics' option to docs / examples
Fixes also -disable_metrics 'process' metric name in running.md, and updates list of '-disable_metrics' option metrics. Metrics names are now listed in sorted order. Note: I've followed the existing documentation convention of giving cAdvisor option names with two dashes (--enable_metrics) although current cAdvisor uses only one dash (-enable_metrics).
1 parent 5ed5a2f commit 63d8378

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

deploy/kubernetes/overlays/examples/cadvisor-args.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
- --max_housekeeping_interval=15s
1818
- --event_storage_event_limit=default=0
1919
- --event_storage_age_limit=default=0
20-
- --disable_metrics=percpu,hugetlb,sched,tcp,udp,advtcp # enable only diskIO, cpu, memory, network, disk, process
20+
- --enable_metrics=disk,diskIO,memory,network,process # app & cpu metrics are always enabled
2121
- --docker_only # only show stats for docker containers
2222
- --store_container_labels=false
2323
- --whitelisted_container_labels=io.kubernetes.container.name, io.kubernetes.pod.name,io.kubernetes.pod.namespace

docs/running.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cAdvisor is now running (in the background) on `http://localhost:8080/`. The set
2323
- If docker daemon is running with [user namespace enabled](https://docs.docker.com/engine/reference/commandline/dockerd/#starting-the-daemon-with-user-namespaces-enabled),
2424
you need to add `--userns=host` option in order for cAdvisor to monitor Docker containers,
2525
otherwise cAdvisor can not connect to docker daemon.
26-
- If cadvisor scrapes `process metrics` by set flag `--disable_metrics`, you need to add `--pid=host` and `--privileged` for `docker run` to get `/proc/pid/fd` path in host.
26+
- If cadvisor scrapes `process` metrics due to `--disable_metrics` or `--enable_metrics` options, you need to add `--pid=host` and `--privileged` for `docker run` to get `/proc/pid/fd` path in host.
2727
- If cAdvisor needs to be run in Docker container without `--privileged` option it is possible to add host devices to container using `--dev` and
2828
specify security options using `--security-opt` with secure computing mode (seccomp).
2929
For details related to seccomp please [see](https://docs.docker.com/engine/security/seccomp/), the default Docker profile can be found [here](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json).

docs/runtime_options.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ cAdvisor stores the latest historical data in memory. How long of a history it s
125125
--application_metrics_count_limit=100: Max number of application metrics to store (per container) (default 100)
126126
--collector_cert="": Collector's certificate, exposed to endpoints for certificate based authentication.
127127
--collector_key="": Key for the collector's certificate
128-
--disable_metrics=referenced_memory,cpu_topology,resctrl,udp,advtcp,sched,hugetlb,memory_numa,tcp,process: comma-separated list of metrics to be disabled. Options are 'accelerator', 'cpu_topology','disk', 'diskIO', 'memory_numa', 'network', 'tcp', 'udp', 'percpu', 'sched', 'process', 'hugetlb', 'referenced_memory', 'resctrl', 'cpuset'. (default referenced_memory,cpu_topology,resctrl,udp,advtcp,sched,hugetlb,memory_numa,tcp,process)
128+
--disable_metrics=<metrics>: comma-separated list of metrics to be disabled. Options are accelerator,advtcp,cpuLoad,cpu_topology,cpuset,disk,diskIO,hugetlb,memory,memory_numa,network,oom_event,percpu,perf_event,process,referenced_memory,resctrl,sched,tcp,udp. (default advtcp,cpu_topology,cpuset,hugetlb,memory_numa,process,referenced_memory,resctrl,sched,tcp,udp)
129+
--enable_metrics=<metrics>: comma-separated list of metrics to be enabled. If set, overrides 'disable_metrics'. Options are accelerator,advtcp,cpuLoad,cpu_topology,cpuset,disk,diskIO,hugetlb,memory,memory_numa,network,oom_event,percpu,perf_event,process,referenced_memory,resctrl,sched,tcp,udp.
129130
--prometheus_endpoint="/metrics": Endpoint to expose Prometheus metrics on (default "/metrics")
130131
--disable_root_cgroup_stats=false: Disable collecting root Cgroup stats
131132
```
@@ -149,7 +150,7 @@ cAdvisor stores the latest historical data in memory. How long of a history it s
149150
--perf_events_config="" Path to a JSON file containing configuration of perf events to measure. Empty value disables perf events measuring.
150151
```
151152

152-
Core perf events can be exposed on Prometheus endpoint per CPU or aggregated by event. It is controlled through `--disable_metrics` parameter with option `percpu`, e.g.:
153+
Core perf events can be exposed on Prometheus endpoint per CPU or aggregated by event. It is controlled through `--disable_metrics` and `--enable_metrics` parameters with option `percpu`, e.g.:
153154
- `--disable_metrics="percpu"` - core perf events are aggregated
154155
- `--disable_metrics=""` - core perf events are exposed per CPU.
155156

docs/storage/prometheus.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Monitoring cAdvisor with Prometheus
22

3-
cAdvisor exposes container and hardware statistics as [Prometheus](https://prometheus.io) metrics out of the box. By default, these metrics are served under the `/metrics` HTTP endpoint. This endpoint may be customized by setting the `-prometheus_endpoint` and `-disable_metrics` command-line flags.
3+
cAdvisor exposes container and hardware statistics as [Prometheus](https://prometheus.io) metrics out of the box. By default, these metrics are served under the `/metrics` HTTP endpoint. This endpoint may be customized by setting the `-prometheus_endpoint` and `-disable_metrics` or `-enable_metrics` command-line flags.
44

55
To collect some of metrics it is required to build cAdvisor with additional flags, for details see [build instructions](../development/build.md), additional flags are indicated in "additional build flag" column in table below.
66

@@ -14,9 +14,9 @@ To monitor cAdvisor with Prometheus, simply configure one or more jobs in Promet
1414

1515
## Prometheus container metrics
1616

17-
The table below lists the Prometheus container metrics exposed by cAdvisor (in alphabetical order by metric name):
17+
The table below lists the Prometheus container metrics exposed by cAdvisor (in alphabetical order by metric name) and corresponding `-disable_metrics` / `-enable_metrics` option parameter:
1818

19-
Metric name | Type | Description | Unit (where applicable) | -disable_metrics parameter | additional build flag |
19+
Metric name | Type | Description | Unit (where applicable) | option parameter | additional build flag |
2020
:-----------|:-----|:------------|:------------------------|:---------------------------|:----------------------
2121
`container_accelerator_duty_cycle` | Gauge | Percent of time over the past sample period during which the accelerator was actively processing | percentage | accelerator |
2222
`container_accelerator_memory_total_bytes` | Gauge | Total accelerator memory | bytes | accelerator |
@@ -97,9 +97,9 @@ Metric name | Type | Description | Unit (where applicable) | -disable_metrics pa
9797

9898
## Prometheus hardware metrics
9999

100-
The table below lists the Prometheus hardware metrics exposed by cAdvisor (in alphabetical order by metric name):
100+
The table below lists the Prometheus hardware metrics exposed by cAdvisor (in alphabetical order by metric name) and corresponding `-disable_metrics` / `-enable_metrics` option parameter:
101101

102-
Metric name | Type | Description | Unit (where applicable) | -disable_metrics parameter | addional build flag |
102+
Metric name | Type | Description | Unit (where applicable) | option parameter | addional build flag |
103103
:-----------|:-----|:------------|:------------------------|:---------------------------|:--------------------
104104
`machine_cpu_cache_capacity_bytes` | Gauge | Cache size in bytes assigned to NUMA node and CPU core | bytes | cpu_topology |
105105
`machine_cpu_cores` | Gauge | Number of logical CPU cores | | |
@@ -112,4 +112,4 @@ Metric name | Type | Description | Unit (where applicable) | -disable_metrics pa
112112
`machine_node_memory_capacity_bytes` | Gauge | Amount of memory assigned to NUMA node | bytes | cpu_topology |
113113
`machine_nvm_avg_power_budget_watts` | Gauge | NVM power budget | watts | | libipmctl
114114
`machine_nvm_capacity` | Gauge | NVM capacity value labeled by NVM mode (memory mode or app direct mode) | bytes | | libipmctl
115-
`machine_thread_siblings_count` | Gauge | Number of CPU thread siblings | | cpu_topology |
115+
`machine_thread_siblings_count` | Gauge | Number of CPU thread siblings | | cpu_topology |

0 commit comments

Comments
 (0)