From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 738EF1FF15F for ; Mon, 4 Nov 2024 19:33:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D88B012486; Mon, 4 Nov 2024 19:33:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bennetgallein.de; s=he217959; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:From:Sender: Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To: References; bh=fHu92bgoQdO1gmqPGFqcI6OM1WbOeA8ELqJlvrUp8S8=; t=1730745162; x=1731177162; b=MljzTJfYu9BaNoLU+Y9Rfs0jNmuM+giu3JUPNIWnULyOLlHFb6EJ6HhYgITrm fiBex5oroexuuOeB8tyHUHD3qEsIzOlSiJ9G/Yrx9JhaSy76ymM5qLlgzbCVsC9DXqJceG5TliG4h O+nEhSAkLYRzwleB6ukHgtVwdiZ3s7/wxJKUEWgW6avie0zD8nN7DKWt8SlPqlM5OGQaY63SgoBs6 gbUlAsaWCXdaLXd/BEhub1ZFrEyd38474rXthF5xzUf/JRRCXZ0hug99ih/xLU75Fk7Un0k+6tff6 azB1f/D9UIlWUOlL3r943jjueGKJZTRCsXuh6y9IQ+da403ZCg==; From: Bennet Gallein To: pve-devel@lists.proxmox.com Date: Mon, 4 Nov 2024 19:32:24 +0100 Message-Id: <20241104183225.1192830-3-me@bennetgallein.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241104183225.1192830-1-me@bennetgallein.de> References: <20241104183225.1192830-1-me@bennetgallein.de> MIME-Version: 1.0 X-bounce-key: webpack.hosteurope.de;me@bennetgallein.de;1730745162;4645ee53; X-HE-SMSGID: 1t81sM-00052N-BG X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_MISSING 0.1 Missing DMARC policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH cluster/qemu-server/container 1/1] add purge_rrd_data sub X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Bennet Gallein --- src/PVE/RRD.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm index 5d4abc9..636226c 100644 --- a/src/PVE/RRD.pm +++ b/src/PVE/RRD.pm @@ -6,6 +6,26 @@ use RRDs; use PVE::Tools; +sub purge_rrd_data { + my ($rrdname) = @_; + + my $rrddir = "/var/lib/rrdcached/db"; + + my $rrd = "$rrddir/$rrdname"; + + my @args = (); + my $socket = "/var/run/rrdcached.sock"; + push @args, "--daemon" => "unix:$socket" if -S $socket; + + # flush cached RRDs + RRDs::flushcached($rrd, @args); + + my $err = RRDs::error; + die "RRD error flushing pre-purge: $err\n" if $err; + + unlink($rrd) or die("ERROR deleting RRD file"); +} + sub create_rrd_data { my ($rrdname, $timeframe, $cf) = @_; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel