Projet

Général

Profil

Révision ca71d12f

IDca71d12f290f1169a225e70b4418423afcbfc5e4
Parent b0d1f5b5
Enfant 46983fdc

Ajouté par Felix Engelmann il y a plus de 9 ans

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

Voir les différences:

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