mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-28 03:44:52 +00:00
fixed lxc_disk with stopped containers
stopped containers have no disk space info and the plugin crashed. Now it only shows disk usage for running containers
This commit is contained in:
parent
365e993200
commit
8b010aadbd
1 changed files with 9 additions and 5 deletions
|
@ -38,11 +38,15 @@ if len(sys.argv) == 2 and sys.argv[1]=="config":
|
||||||
print("graph_category lxd")
|
print("graph_category lxd")
|
||||||
print("graph_info This shows the disk usage of storage in containers. Make sure to install pylxd in python3.")
|
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 name in c.container_list():
|
||||||
for disk in c.container_info(name)['disk']:
|
info = c.container_info(name)
|
||||||
print(name+"-"+disk+".label "+name)
|
if info['disk']:
|
||||||
print(name+"-"+disk+".draw LINE2")
|
for disk in info['disk']:
|
||||||
|
print(name+"-"+disk+".label "+name)
|
||||||
|
print(name+"-"+disk+".draw LINE2")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
for name in c.container_list():
|
for name in c.container_list():
|
||||||
for disk in c.container_info(name)['disk']:
|
info = c.container_info(name)
|
||||||
print(name+"-"+disk+".value "+str(c.container_info(name)['disk'][disk]['usage']))
|
if info['disk']:
|
||||||
|
for disk in info['disk']:
|
||||||
|
print(name+"-"+disk+".value "+str(info['disk'][disk]['usage']))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue