2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #743 from felix-engelmann/master

fixed lxd_disk for stopped containers
This commit is contained in:
sumpfralle 2016-10-20 04:28:15 +02:00 committed by GitHub
commit 178a3d148e

View File

@ -38,11 +38,19 @@ if len(sys.argv) == 2 and sys.argv[1]=="config":
print("graph_category lxd")
print("graph_info This shows the disk usage of storage in containers. Make sure to install pylxd in python3.")
for name in c.container_list():
for disk in c.container_info(name)['disk']:
info = c.container_info(name)
# first check if disk information list is available or None
if info['disk']:
# if no disk information is present, this would fail to iteration None
for disk in info['disk']:
print(name+"-"+disk+".label "+name)
print(name+"-"+disk+".draw LINE2")
sys.exit(0)
for name in c.container_list():
for disk in c.container_info(name)['disk']:
print(name+"-"+disk+".value "+str(c.container_info(name)['disk'][disk]['usage']))
info = c.container_info(name)
# first check if disk information list is available or None
if info['disk']:
# if no disk information is present, this would fail to iteration None
for disk in info['disk']:
print(name+"-"+disk+".value "+str(info['disk'][disk]['usage']))