1
0
Fork 0
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:
Oliver 2021-05-04 09:53:55 +02:00 committed by Lars Kruse
parent 78aac0314b
commit 64d5d8af08

View file

@ -320,9 +320,10 @@ def print_containers_network(client):
for container, stats in parallel_container_stats(client):
tx_bytes = 0
rx_bytes = 0
for data in stats['networks'].values():
tx_bytes += data['tx_bytes']
rx_bytes += data['rx_bytes']
if "networks" in stats:
for data in stats['networks'].values():
tx_bytes += data['tx_bytes']
rx_bytes += data['rx_bytes']
clean_container_name = clean_fieldname(container.name)
print(clean_container_name + '_up.value', tx_bytes)
print(clean_container_name + '_down.value', rx_bytes)