librato / librato-collectd-docker

Collectd plugin for Docker cgroup metrics
MIT License
9 stars 7 forks source link

Stats collection fails for containers with no network #14

Open brendan-munro opened 7 years ago

brendan-munro commented 7 years ago

I recently ran up this plugin on our Nomad docker servers, and found that it crashed during statistics collection when interacting with a container launched with networked mode set to "host". In this situation, the "networks" section of the JSON object is missing, not empty. This causes the script to crash on line 374, in turn causing the other metrics to not be collected.

This should be correctable with a simple check to see if the key is present before iterating.