Révision ca71d12f
added lxd memory plugin
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
| plugins/lxd/lxd_mem | ||
|---|---|---|
| 1 |
#!/usr/bin/python3 |
|
| 2 |
|
|
| 3 |
import sys |
|
| 4 |
from pylxd import api |
|
| 5 |
|
|
| 6 |
c=api.API() |
|
| 7 |
|
|
| 8 |
if len(sys.argv) == 2: |
|
| 9 |
if sys.argv[1]=="autoconf": |
|
| 10 |
print("yes")
|
|
| 11 |
sys.exit(0) |
|
| 12 |
elif sys.argv[1]=="config": |
|
| 13 |
print("graph_title LXD container memory")
|
|
| 14 |
print("graph_args --base 1024 --lower-limit 0")
|
|
| 15 |
print("graph_vlabel Bytes")
|
|
| 16 |
print("graph_category lxd")
|
|
| 17 |
print("graph_info This shows the memory usage of each container. Make sure to install pylxd in python3.")
|
|
| 18 |
for name in c.container_list(): |
|
| 19 |
print(name+".label "+name) |
|
| 20 |
print(name+".draw AREASTACK") |
|
| 21 |
sys.exit(0) |
|
| 22 |
|
|
| 23 |
for name in c.container_list(): |
|
| 24 |
print(name+".value "+str(c.container_info(name)['memory']['usage'])) |
|
Formats disponibles : Unified diff