mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Added check to ensure network stats for container exist before reading them
This commit is contained in:
parent
78aac0314b
commit
64d5d8af08
1 changed files with 4 additions and 3 deletions
|
@ -320,9 +320,10 @@ def print_containers_network(client):
|
||||||
for container, stats in parallel_container_stats(client):
|
for container, stats in parallel_container_stats(client):
|
||||||
tx_bytes = 0
|
tx_bytes = 0
|
||||||
rx_bytes = 0
|
rx_bytes = 0
|
||||||
for data in stats['networks'].values():
|
if "networks" in stats:
|
||||||
tx_bytes += data['tx_bytes']
|
for data in stats['networks'].values():
|
||||||
rx_bytes += data['rx_bytes']
|
tx_bytes += data['tx_bytes']
|
||||||
|
rx_bytes += data['rx_bytes']
|
||||||
clean_container_name = clean_fieldname(container.name)
|
clean_container_name = clean_fieldname(container.name)
|
||||||
print(clean_container_name + '_up.value', tx_bytes)
|
print(clean_container_name + '_up.value', tx_bytes)
|
||||||
print(clean_container_name + '_down.value', rx_bytes)
|
print(clean_container_name + '_down.value', rx_bytes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue