mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
the lxd deamon provides a REST interface which can be queried by pylxd to get container related information. It graphs the disk usage of all disks in all containers. This plugin depends on python3 pylxd
26 lines
886 B
Python
Executable file
26 lines
886 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 disk usage")
|
|
print("graph_args --base 1000 --lower-limit 0")
|
|
print("graph_vlabel Bytes")
|
|
print("graph_category lxd")
|
|
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 disk in c.container_info(name)['disk']:
|
|
print(name+"-"+disk+".label "+name)
|
|
print(name+"-"+disk+".draw LINE2")
|
|
sys.exit(0)
|
|
|
|
for name in c.container_list():
|
|
for disk in c.container_info(name)['disk']:
|
|
print(name+"-"+disk+".value "+str(c.container_info(name)['disk'][disk]['usage']))
|