From e9f910ea23febda803a7214764b5d03cdc548216 Mon Sep 17 00:00:00 2001 From: Mickael B Date: Wed, 23 Oct 2024 12:30:58 +0200 Subject: [PATCH] stats dom --- deevirt_schema/libvirt/dom/stats/__init__py | 0 deevirt_schema/libvirt/dom/stats/cpu.py | 9 +++++++++ deevirt_schema/libvirt/dom/stats/disk.py | 16 ++++++++++++++++ deevirt_schema/libvirt/dom/stats/memory.py | 18 ++++++++++++++++++ deevirt_schema/libvirt/dom/stats/network.py | 18 ++++++++++++++++++ setup.py | 2 +- 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 deevirt_schema/libvirt/dom/stats/__init__py create mode 100644 deevirt_schema/libvirt/dom/stats/cpu.py create mode 100644 deevirt_schema/libvirt/dom/stats/disk.py create mode 100644 deevirt_schema/libvirt/dom/stats/memory.py create mode 100644 deevirt_schema/libvirt/dom/stats/network.py diff --git a/deevirt_schema/libvirt/dom/stats/__init__py b/deevirt_schema/libvirt/dom/stats/__init__py new file mode 100644 index 0000000..e69de29 diff --git a/deevirt_schema/libvirt/dom/stats/cpu.py b/deevirt_schema/libvirt/dom/stats/cpu.py new file mode 100644 index 0000000..96111a3 --- /dev/null +++ b/deevirt_schema/libvirt/dom/stats/cpu.py @@ -0,0 +1,9 @@ +from pydantic import BaseModel, ConfigDict, Field +from time import time_ns + +class CPU(BaseModel): + model_config = ConfigDict() + time:int = Field(default_factory=time_ns) + user:int = Field() + system:int = Field() + count:int = Field() \ No newline at end of file diff --git a/deevirt_schema/libvirt/dom/stats/disk.py b/deevirt_schema/libvirt/dom/stats/disk.py new file mode 100644 index 0000000..c716afc --- /dev/null +++ b/deevirt_schema/libvirt/dom/stats/disk.py @@ -0,0 +1,16 @@ + +from pydantic import UUID4, BaseModel, ConfigDict, Field +from time import time_ns + +class DiskFlows(BaseModel): + bytes:int = Field() + reqs:int = Field() + times:int = Field() + +class Disk(BaseModel): + model_config = ConfigDict() + time:int = Field(default_factory=time_ns) + uuid:UUID4 = Field() + name:str = Field() + read:DiskFlows = Field() + write:DiskFlows = Field() \ No newline at end of file diff --git a/deevirt_schema/libvirt/dom/stats/memory.py b/deevirt_schema/libvirt/dom/stats/memory.py new file mode 100644 index 0000000..812e290 --- /dev/null +++ b/deevirt_schema/libvirt/dom/stats/memory.py @@ -0,0 +1,18 @@ +from typing import Optional +from pydantic import BaseModel, ConfigDict, Field + +class MemorySwap(BaseModel): + swp_in:int = Field(serialization_alias="in") + swp_out:Optional[int] = Field(default=None, serialization_alias="out") + +class Memory(BaseModel): + model_config = ConfigDict() + time:int = Field() + available:Optional[int] = Field(default=None) + current:int = Field() + maximum:int = Field() + disk_caches:Optional[int] = Field(default=None) + rss:int = Field() + swap:MemorySwap = Field() + unused:Optional[int] = Field(default=None) + usable:Optional[int] = Field(default=None) \ No newline at end of file diff --git a/deevirt_schema/libvirt/dom/stats/network.py b/deevirt_schema/libvirt/dom/stats/network.py new file mode 100644 index 0000000..9111632 --- /dev/null +++ b/deevirt_schema/libvirt/dom/stats/network.py @@ -0,0 +1,18 @@ +from typing import Any, List +from pydantic import UUID4, BaseModel, ConfigDict, Field +from time import time_ns + +class InterfaceFlows(BaseModel): + bytes:int = Field() + drop:int = Field() + errs:int = Field() + pkts:int = Field() + +class Interface(BaseModel): + model_config = ConfigDict() + + uuid:UUID4 = Field() + time:int = Field(default_factory=time_ns) + name:str = Field() + rx:InterfaceFlows = Field() + tx:InterfaceFlows = Field() \ No newline at end of file diff --git a/setup.py b/setup.py index d5e0fd4..2ff0bfa 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import find_packages, setup setup( name='deevirt_schema', - version='0.1.0', + version='0.1.1', description='Deevirt Schema', url='https://git.celeonet.fr/Deevirt/deevirt_schema.git', author='Celeonet',