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 487DB1FF1D0 for ; Tue, 26 Aug 2025 15:51:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C112834C55; Tue, 26 Aug 2025 15:51:36 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Tue, 26 Aug 2025 15:51:10 +0200 Message-ID: <20250826135119.336510-16-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250826135119.336510-1-l.wagner@proxmox.com> References: <20250826135119.336510-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1756216281613 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.124 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 proxmox-datacenter-manager v7 15/24] api: add endpoint to trigger metric collection 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" This one lives under /metric-collection/trigger. Doing a POST will trigger metric collection for a remote provided in the 'remote' parameter, or all remotes if the parameter is not provided. Signed-off-by: Lukas Wagner Reviewed-by: Maximiliano Sandoval Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak --- server/src/api/metric_collection.rs | 27 ++++++--------------------- server/src/api/mod.rs | 2 ++ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/server/src/api/metric_collection.rs b/server/src/api/metric_collection.rs index 0658fb1f..308ceca2 100644 --- a/server/src/api/metric_collection.rs +++ b/server/src/api/metric_collection.rs @@ -1,26 +1,17 @@ use anyhow::Error; +use pdm_api_types::remotes::REMOTE_ID_SCHEMA; use proxmox_router::{Router, SubdirMap}; use proxmox_schema::api; use proxmox_sortable_macro::sortable; -use pdm_api_types::{remotes::REMOTE_ID_SCHEMA, MetricCollectionStatus}; - -use crate::metric_collection; - pub const ROUTER: Router = Router::new().subdirs(SUBDIRS); #[sortable] -const SUBDIRS: SubdirMap = &sorted!([ - ( - "trigger", - &Router::new().post(&API_METHOD_TRIGGER_METRIC_COLLECTION) - ), - ( - "status", - &Router::new().get(&API_METHOD_GET_METRIC_COLLECTION_STATUS) - ), -]); +const SUBDIRS: SubdirMap = &sorted!([( + "trigger", + &Router::new().post(&API_METHOD_TRIGGER_METRIC_COLLECTION) +),]); #[api( input: { @@ -34,13 +25,7 @@ const SUBDIRS: SubdirMap = &sorted!([ )] /// Trigger metric collection for a provided remote or for all remotes if no remote is passed. pub async fn trigger_metric_collection(remote: Option) -> Result<(), Error> { - crate::metric_collection::trigger_metric_collection(remote, false).await?; + crate::metric_collection::trigger_metric_collection(remote).await?; Ok(()) } - -#[api] -/// Read metric collection status. -fn get_metric_collection_status() -> Result, Error> { - metric_collection::get_status() -} diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index 6c4831b4..ff875fc8 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -9,6 +9,7 @@ use proxmox_sortable_macro::sortable; pub mod access; pub mod config; +pub mod metric_collection; pub mod nodes; pub mod pbs; pub mod pve; @@ -21,6 +22,7 @@ mod rrd_common; const SUBDIRS: SubdirMap = &sorted!([ ("access", &access::ROUTER), ("config", &config::ROUTER), + ("metric-collection", &metric_collection::ROUTER), ("ping", &Router::new().get(&API_METHOD_PING)), ("pve", &pve::ROUTER), ("pbs", &pbs::ROUTER), -- 2.47.2 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel