diff --git a/plugins/lxd/lxd_mem b/plugins/lxd/lxd_mem new file mode 100755 index 00000000..9895133f --- /dev/null +++ b/plugins/lxd/lxd_mem @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +import sys +from pylxd import api + +c=api.API() + +if len(sys.argv) == 2: + if sys.argv[1]=="autoconf": + print("yes") + sys.exit(0) + elif sys.argv[1]=="config": + print("graph_title LXD container memory") + print("graph_args --base 1024 --lower-limit 0") + print("graph_vlabel Bytes") + print("graph_category lxd") + print("graph_info This shows the memory usage of each container. Make sure to install pylxd in python3.") + for name in c.container_list(): + print(name+".label "+name) + print(name+".draw AREASTACK") + sys.exit(0) + +for name in c.container_list(): + print(name+".value "+str(c.container_info(name)['memory']['usage']))