Révision 3a20ae41
[docker_] memory: report `usage` if `total_rss` is not available
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
| plugins/docker/docker_ | ||
|---|---|---|
| 275 | 275 |
|
| 276 | 276 |
def print_containers_memory(client): |
| 277 | 277 |
for container, stats in parallel_container_stats(client): |
| 278 |
print(container.name + '.value', stats['memory_stats']['stats']['total_rss']) |
|
| 279 |
print(container.name + '.extinfo', container_attributes(container)) |
|
| 278 |
if 'total_rss' in stats['memory_stats']['stats']: # cgroupv1 only? |
|
| 279 |
memory_usage = stats['memory_stats']['stats']['total_rss'] |
|
| 280 |
extinfo = 'Resident Set Size' |
|
| 281 |
else: |
|
| 282 |
memory_usage = stats['memory_stats']['usage'] |
|
| 283 |
extinfo = 'Total memory usage' |
|
| 284 |
print(container.name + '.value', memory_usage) |
|
| 285 |
print(container.name + '.extinfo', container_attributes(container, extinfo)) |
|
| 280 | 286 |
|
| 281 | 287 |
|
| 282 | 288 |
def print_containers_network(client): |
Formats disponibles : Unified diff