Projet

Général

Profil

Révision 46983fdc

ID46983fdc99f530476fd5c9abdf64b3be52ae3a9a
Parent ca71d12f
Enfant 365e9932

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

added lxd disk plugin

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

Voir les différences:

plugins/lxd/lxd_disk
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']))

Formats disponibles : Unified diff