From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2 2/4] api: add system report API
Date: Mon, 1 Dec 2025 16:32:27 +0100 [thread overview]
Message-ID: <20251201153229.347742-3-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251201153229.347742-1-l.wagner@proxmox.com>
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@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@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
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-12-01 15:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 15:32 [pdm-devel] [PATCH datacenter-manager v2 0/4] system report via admin cli or API Lukas Wagner
2025-12-01 15:32 ` [pdm-devel] [PATCH datacenter-manager v2 1/4] server: add system report implementation Lukas Wagner
2025-12-01 15:32 ` Lukas Wagner [this message]
2025-12-01 15:32 ` [pdm-devel] [PATCH datacenter-manager v2 3/4] cli: admin: add 'report' command to generate a system report Lukas Wagner
2025-12-01 15:32 ` [pdm-devel] [PATCH datacenter-manager v2 4/4] pdm-client: add bindings for system report generation Lukas Wagner
2025-12-01 15:42 ` [pdm-devel] [PATCH datacenter-manager v2 0/4] system report via admin cli or API Shannon Sterz
2025-12-01 18:26 ` [pdm-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251201153229.347742-3-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.