]> git.proxmox.com Git - proxmox-backup.git/blame - pbs-api-types/src/node.rs
tree-wide: run cargo fmt
[proxmox-backup.git] / pbs-api-types / src / node.rs
CommitLineData
6d33fb6f 1use proxmox_schema::*;
6c5248fb 2use serde::{Deserialize, Serialize};
6d33fb6f
DM
3
4use crate::StorageStatus;
5
6d33fb6f
DM
6#[api]
7#[derive(Serialize, Deserialize, Default)]
8#[serde(rename_all = "kebab-case")]
9/// Node memory usage counters
10pub struct NodeMemoryCounters {
11 /// Total memory
12 pub total: u64,
13 /// Used memory
14 pub used: u64,
15 /// Free memory
16 pub free: u64,
17}
18
19#[api]
20#[derive(Serialize, Deserialize, Default)]
21#[serde(rename_all = "kebab-case")]
22/// Node swap usage counters
23pub struct NodeSwapCounters {
24 /// Total swap
25 pub total: u64,
26 /// Used swap
27 pub used: u64,
28 /// Free swap
29 pub free: u64,
30}
31
32#[api]
33#[derive(Serialize, Deserialize, Default)]
34#[serde(rename_all = "kebab-case")]
35/// Contains general node information such as the fingerprint`
36pub struct NodeInformation {
37 /// The SSL Fingerprint
38 pub fingerprint: String,
39}
40
41#[api]
42#[derive(Serialize, Deserialize, Default)]
43#[serde(rename_all = "kebab-case")]
44/// Information about the CPU
45pub struct NodeCpuInformation {
46 /// The CPU model
47 pub model: String,
48 /// The number of CPU sockets
49 pub sockets: usize,
50 /// The number of CPU cores (incl. threads)
51 pub cpus: usize,
52}
53
54#[api(
55 properties: {
56 memory: {
57 type: NodeMemoryCounters,
58 },
59 root: {
60 type: StorageStatus,
61 },
62 swap: {
63 type: NodeSwapCounters,
64 },
65 loadavg: {
66 type: Array,
67 items: {
68 type: Number,
69 description: "the load",
70 }
71 },
72 cpuinfo: {
73 type: NodeCpuInformation,
74 },
75 info: {
76 type: NodeInformation,
77 }
78 },
79)]
80#[derive(Serialize, Deserialize, Default)]
81#[serde(rename_all = "kebab-case")]
82/// The Node status
83pub struct NodeStatus {
84 pub memory: NodeMemoryCounters,
85 pub root: StorageStatus,
86 pub swap: NodeSwapCounters,
87 /// The current uptime of the server.
88 pub uptime: u64,
89 /// Load for 1, 5 and 15 minutes.
90 pub loadavg: [f64; 3],
91 /// The current kernel version.
92 pub kversion: String,
93 /// Total CPU usage since last query.
94 pub cpu: f64,
95 /// Total IO wait since last query.
96 pub wait: f64,
97 pub cpuinfo: NodeCpuInformation,
98 pub info: NodeInformation,
99}