Skip to content

Commit

Permalink
added lxd memory plugin
Browse files Browse the repository at this point in the history
the lxd deamon provides a REST interface which can be queried by pylxd
to get container related information. It stacks all containers, so the
total memory footprint of lxd is visible.

This plugin depends on python3 pylxd
  • Loading branch information
felix-engelmann committed Aug 3, 2016
1 parent b0d1f5b commit ca71d12
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions plugins/lxd/lxd_mem
Original file line number Diff line number Diff line change
@@ -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']))

0 comments on commit ca71d12

Please sign in to comment.