1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 10:28:36 +00:00
Munin-Contrib/plugins/lxd/lxd_mem
Felix Engelmann ca71d12f29 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
2016-08-03 12:49:53 +02:00

24 lines
734 B
Python
Executable file

#!/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']))