From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id EB3801FF178 for ; Mon, 1 Dec 2025 13:59:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 861881BEEA; Mon, 1 Dec 2025 13:59:35 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Mon, 1 Dec 2025 13:58:56 +0100 Message-ID: <20251201125859.237091-3-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251201125859.237091-1-l.wagner@proxmox.com> References: <20251201125859.237091-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764593898443 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.118 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager 2/4] api: add system report API X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 --- 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 { + 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