[pdm-devel] [PATCH datacenter-manager v2 2/4] api: add system report API

Lukas Wagner l.wagner at proxmox.com
Mon Dec 1 16:32:27 CET 2025


Adds a new API endpoint under /nodes/localhost/report which returns the
system report. To access it, the user/token needs Sys.Audit on
/system/status, same as in PBS.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich at proxmox.com>
Reviewed-by: Shannon Sterz  <s.sterz at proxmox.com>
Tested-by: Shannon Sterz  <s.sterz at proxmox.com>
---
 server/src/api/nodes/mod.rs    |  2 ++
 server/src/api/nodes/report.rs | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 server/src/api/nodes/report.rs

diff --git a/server/src/api/nodes/mod.rs b/server/src/api/nodes/mod.rs
index a0fe14ab..d6dadb80 100644
--- a/server/src/api/nodes/mod.rs
+++ b/server/src/api/nodes/mod.rs
@@ -9,6 +9,7 @@ pub mod config;
 pub mod dns;
 pub mod journal;
 pub mod network;
+pub mod report;
 pub mod rrddata;
 pub mod status;
 pub mod syslog;
@@ -44,6 +45,7 @@ pub const SUBDIRS: SubdirMap = &sorted!([
     ("dns", &dns::ROUTER),
     ("journal", &journal::ROUTER),
     ("network", &network::ROUTER),
+    ("report", &report::ROUTER),
     ("rrdata", &rrddata::ROUTER),
     ("status", &status::ROUTER),
     ("syslog", &syslog::ROUTER),
diff --git a/server/src/api/nodes/report.rs b/server/src/api/nodes/report.rs
new file mode 100644
index 00000000..f8c41000
--- /dev/null
+++ b/server/src/api/nodes/report.rs
@@ -0,0 +1,32 @@
+use anyhow::Error;
+
+use proxmox_router::{Permission, Router};
+use proxmox_schema::api;
+
+use pdm_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT};
+
+use crate::report;
+
+#[api(
+    protected: true,
+    input: {
+        properties: {
+            node: {
+                schema: NODE_SCHEMA,
+            },
+        },
+    },
+    returns: {
+        type: String,
+        description: "The system report for this PDM node.",
+    },
+    access: {
+        permission: &Permission::Privilege(&["system", "status"], PRIV_SYS_AUDIT, false),
+    }
+)]
+/// Get the system report for this node.
+pub fn generate_system_report() -> Result<String, Error> {
+    Ok(report::generate_report())
+}
+
+pub const ROUTER: Router = Router::new().get(&API_METHOD_GENERATE_SYSTEM_REPORT);
-- 
2.47.3





More information about the pdm-devel mailing list