Commit Graph

354 Commits

Author SHA1 Message Date
Rohit Agarwal
4a35130019 Collect container-level GPU metrics using NVML.
When cAdvisor starts up, it would read the `vendor` files in
`/sys/bus/pci/devices/*` to see if any NVIDIA devices (vendor ID: 0x10de) are
attached to the node. If no NVIDIA devices are found, this code path would
become dormant for the rest of cAdvisor lifetime. If NVIDIA devices are found,
we would start a goroutine that would check for the presence of NVML by trying
to dynamically load it at regular intervals. We need to do this regular
checking instead of doing it just once because it may happen that cAdvisor is
started before the NVIDIA drivers and NVML are installed.  Once the NVML
dynamic loading succeeds, we would use NVML’s query methods to find out how
many devices exist on the node and create a map from their minor numbers to
their handles and cache that map. The goroutine would exit at this point.

If we detected the presence of NVML in the previous step, whenever a new
container is detected by cAdvisor, cAdvisor would read the `devices.list` file
from the container's devices cgroup. The `devices.list` file lists the
major:minor number of all the devices that the container is allowed to access.
If we find any device with major number 195 (which is the major number assigned
to NVIDIA devices), we would cache the list of corresponding minor numbers for
that container.

During every housekeeping operation, in addition to collecting all the existing
metrics, we will use the cached NVIDIA device minor numbers and the map from
minor numbers to device handles to get metrics for GPU devices attached to the
container.
2017-11-06 11:54:59 -08:00
David Ashpole
6d3841c68a
Merge pull request #1784 from majst01/misspelled-errors
Fix wrong error checking in fsHandler.go
2017-10-30 10:02:08 -07:00
Seth Jennings
cc77f13a2b fix long du message 2017-10-30 10:00:47 -05:00
Stefan Majer
d5e2ffbef7 Fix wrong error checking in fsHandler.go 2017-10-30 07:44:57 +01:00
Antonio Murdaca
088aaf1a32
CRI-O: fix handling of overlay2 storage
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-21 12:05:40 +02:00
Euan Kemp
587691c7f3 libcontainer: ignore nil cpustats
Cadvisor can inotify watch for new cgroups. This leads to it racing
fairly tightly with cgroup creation... So tightly, that sometimes
cpustats are nil.

The runc library code we call
(https://github.com/opencontainers/runc/blob/v1.0.0-rc4/libcontainer/cgroups/fs/apply_raw.go#L179-L182)
doesn't actaully consider this an error, so we have to handle that
scenario ourselves.

This fixes https://github.com/google/cadvisor/issues/1765
2017-10-20 13:08:23 -07:00
David Ashpole
b7959da460 monitor diff directory for overlay2 2017-10-11 14:13:42 -07:00
Derek Carr
9ea61176bf Expose memory.max_usage_in_bytes in container stats 2017-10-10 17:31:31 -04:00
Seth Jennings
fd9c6d2fde adaptive longOp for du operation 2017-10-05 09:22:54 -05:00
David Ashpole
888a529088 fix #1743; move off of docker/engine-api 2017-09-28 11:05:13 -07:00
David Ashpole
e6b6a1ac57 fix #1708; move from inotify to fsnotify 2017-09-28 10:57:49 -07:00
Antonio Murdaca
4b002b3bd3
*: add CRI-O handler
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-05 17:01:58 +02:00
Euan Kemp
d2e11efba2 libcontainer: use real number of CPUs for usage
As of the 4.7 kernel, the cpustats field returned from libcontainer
contains values for every possible cpu (including nonexistent ones).
The extra values are all 0s.

If we assume that hotplug events won't happen, we can get a more
accurage cpu count by using runtime.NumCPU and then ignoring any values
beyond that.
2017-08-30 14:26:26 -07:00
Karl
5a033c064e Add runtime options for TLS support 2017-08-24 15:14:33 +02:00
Derek Carr
6fa48d9048 Expose total_rss when hierarchy is enabled 2017-08-23 14:56:59 -04:00
Derek Carr
d493f11f0b Reduce log spam when unable to get network stats 2017-08-18 16:11:03 -04:00
Andrew Pilloud
9e40f1c837 Fix race in ignoring non-existent files 2017-06-08 11:16:31 -07:00
David Ashpole
96b603e20a Merge branch 'master' into overlay2 2017-05-31 14:05:54 -07:00
David Ashpole
de308101e4 Merge branch 'master' into container-restart-count 2017-05-30 11:33:39 -07:00
Ricardo Pchevuzinske Katz
f5a896ef4c Gather information from RestartCount counter and put into labels 2017-05-30 14:05:14 -03:00
Andy Goldstein
69c085d9fa Cache the Docker thin pool name
Cache the Docker thin pool name in the dockerFactory and pass it to each Docker container handler,
instead of calling `docker info` each time a new container handler is created, as the thin pool name
is extremely unlikely to change.
2017-05-30 11:50:58 -04:00
Clayton Coleman
4e25a7951f
Report container FS metrics into prometheus /metrics
PerDiskStats reported from cgroups were not being surfaced into
prometheus. In order to properly correlate the metrics, we need to
assign a device label to each metric (which is the FS or device path).
Since blkio cgroup tracks devices, we create a synthetic device
`/dev/NAME` for the metric.

Assign a Device label to each PerDiskStat for the handlers up front, and
then surface the PerDiskStat values into the prometheus metrics. Report
two new metrics - total bytes read and total bytes written.
2017-04-24 20:46:55 -04:00
Bilal Amarni
e0c8ec569d [docker] add overlay2 storage driver
Signed-off-by: Bilal Amarni <bilal.amarni@gmail.com>
2017-04-13 13:39:45 +02:00
Tristan Colgate
227bb3a79d Add udp and udp6 network statistics 2017-04-10 20:41:51 +01:00
Manjunath A Kumatagi
8fb1158353 Add Docker API version 2017-04-04 10:56:11 +05:30
Brian Akins
feecd47daa Add watcher for zfs similar to devicemapper
minor cleanup

ensure we look at parent dataset for limit, etc
2017-03-15 18:31:11 -04:00
Derek Carr
b172ba65b4 disable thin_ls due to excessive iops 2017-02-09 10:29:58 -05:00
Calum Lacroix
6d67091c8b Checks for successful string split on env variable 2017-02-08 22:39:34 +00:00
Calum Lacroix
967e09a3a5 Checks environment variables for empty strings
If an environment variable is an empty string, cadvisor panics and fails to start
2017-02-08 18:44:56 +00:00
Derek Carr
4ad5c58f6a Ignore any .mount cgroup in docker handler 2017-01-16 11:02:37 -05:00
David Ashpole
9fdeefe3e4 Cadvisor now publishes per-container inode stats using the command 'find . -xdev printf '.'| wc -c' this is published in the v2 api using a new field 2016-10-12 13:16:21 -07:00
Tim St. Clair
afe67fec68
Cleanup comment style: // should be proceded by a space 2016-10-07 17:06:02 -07:00
derekwaynecarr
b84046f12c Look at all cgroup mounts 2016-09-22 15:34:59 -04:00
Chun Chen
844c98e073 GetSpec missing memory reservation 2016-08-16 23:26:46 +08:00
Florian Koch
3ce98a46c4 add cgropu swap usage and export as prometheus metric 2016-08-09 07:33:37 +02:00
Tobias Schmidt
1653733ea7 Expose cpu cgroup CFS prometheus metrics
If CPU quota is configured (cpu.cfs_quota != -1) the CFS will provide
stats about elapsed periods and throtting in cpu.stats. This change
makes these information available as container_cpu_cfs_* metrics.
2016-08-06 18:08:26 -04:00
Andy Goldstein
2b525ff87e Ensure minimum kernel version for thin_ls
Ensure that kernel >= 4.4.0 or RHEL/Centos 7 kernel >= 3.10.0-366 exists before starting the thin
pool watcher. Prior versions have a bug in which reserving and releasing the metadata snapshot can
cause thin pool corruption.
2016-08-04 16:14:40 -04:00
derekwaynecarr
6c114be580 Expose total inodes 2016-08-02 10:47:51 -04:00
Tim St. Clair
bbe54c0a10 Merge pull request #1368 from derekwaynecarr/inodes_pointer
Allow clients to know if inodes data is available
2016-07-29 10:10:30 -07:00
derekwaynecarr
cccf9d5fec Allow clients to know if inodes are supported on a filesystem 2016-07-26 11:15:07 -04:00
Andy Goldstein
d05098b314 Lower ThinPoolWatcher cache miss log level 2016-07-23 07:07:42 -04:00
Michael Taufen
307d1b1cb3 Modify working set memory stats calculation
Change working set calculation to usage - total_inactive_file, rather than
usage - total_inactive_anon - total_inactive_file. Since writes to tmpfs
get tracked as total_inactive_anon when swap is disabled, the old
calculation would under-report memory pressure.

See this Kubernetes issue for context:
https://github.com/kubernetes/kubernetes/issues/28619
2016-07-15 10:58:25 -07:00
Matt Wringe
213c254bb7 Add in the ability to expose the ip address of a container. 2016-07-13 13:58:43 -04:00
Tim St. Clair
35f7bc5ee7 Move mocks to testing package to remove +build tags
Some go tools (e.g. godef, gorename) don't handle +build tags well, so
I refactored some packages to remove the test tags from cAdvisor.
2016-07-06 14:15:43 -07:00
Seth Jennings
eafff745a5 only fail fs stat gather if metadata device not found 2016-06-21 16:05:37 -05:00
Paul Morie
c37d048e1b Check for thin_ls binary in path when using ThinPoolWatcher 2016-06-14 13:19:05 -04:00
Tim St. Clair
3fbe18de9a Merge pull request #1204 from pmorie/dm-support
devicemapper thin_ls support
2016-05-18 12:30:05 -07:00
Paul Morie
647224c95a Add devicemapper support for docker containers 2016-05-18 15:19:20 -04:00
Shaya Potter
6fa3687720 Polling rkt implementation of new watcher inteface (#1284)
polling rkt implementation of new watcher inteface
2016-05-17 10:34:56 -07:00
Shaya Potter
e02632463b Refactor container watching out of raw handler into its own inteface / package 2016-05-11 20:27:10 -07:00