Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / lxd / lxd_disk @ 46983fdc

Historique | Voir | Annoter | Télécharger (886 octets)

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 disk usage")
14
        print("graph_args --base 1000 --lower-limit 0")
15
        print("graph_vlabel Bytes")
16
        print("graph_category lxd")
17
        print("graph_info This shows the disk usage of storage in containers. Make sure to install pylxd in python3.")
18
        for name in c.container_list():
19
            for disk in c.container_info(name)['disk']:
20
                print(name+"-"+disk+".label "+name)
21
                print(name+"-"+disk+".draw LINE2")
22
        sys.exit(0)
23

    
24
for name in c.container_list():
25
    for disk in c.container_info(name)['disk']:
26
        print(name+"-"+disk+".value "+str(c.container_info(name)['disk'][disk]['usage']))