From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7C99060704 for ; Wed, 2 Feb 2022 10:50:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B439419E65 for ; Wed, 2 Feb 2022 10:50:35 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id AA4C719D34 for ; Wed, 2 Feb 2022 10:50:27 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2954A46CD5 for ; Wed, 2 Feb 2022 10:50:21 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 2 Feb 2022 10:50:09 +0100 Message-Id: <20220202095019.1799843-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.012 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox/proxmox-backup v5] add metrics server capability X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2022 09:50:36 -0000 this series adds support for exporting metrics data to external metric servers. for now this includes only data we gather for RRD, though it should not be hard to extend that functionality also only influxdb (udp/http(s)) is currently supported, but it should also not be too hard to include more options here this also includes a gui now the 'cannot create with --enable' bug matthias mentioned seems to be a quirk of the proxmox-backup-debug binary, the api/gui works just fine... (i'll check it out soon) this versions has some additional changes that were necessary and i only noticed that because i wrote the gui ... ofc, proxmox-backup depends on bumped versions of the proxmox-* crates changes from v4: * rebase on master * move connect_to_udp to udp::connect(), and let it really try every address * adds 'test_influxdb_http/udp' functions that try to connect for some sanity checks. (needed a little refactor in the http/udp parts but mostly code move) * checks the server connection on create/edit via api when the enable flag is set * adds a generic 'list' api call in /admin/metricserver since we need a place where we return *all* metrics servers regardless of type (and this is the way we do it e.g. for realms) * adds the gui to view/add/edit/delete the metric servers (i put it under configuration, but that gets crowded... maybe there is a better place?) changes from v3: * rebase on master * introduced helper functions instead of InfluxDBHttp::new * start tokio task directly in the helper * combine channel close + join * fix api description * combine host/port/protocol in the api types * introduce a connect_to_udp helper * use NixPath in the fs_info helper changes from v2: * rebase on master * rustfmt * clippy (fixed not everything) * renamed DiskUsage in proxmox-sys and added some more fields * added 'enable' property for the config (like we have in pve) * subtracted 50bytes from mtu in the udp variant (for ip header) changes from v1: * fixed ipv6 support for udp (tested it this time ;) ) * dropped the 'flush' functionality of the MetricsChannel, but kept the wrapper struct: it did not do what i intended, and after rethinking it, turns out it's not necessary (as we autoflush when the data gets to large, or when we close the channel). kept the struct so that the interface can stay the same even if we want to implement a manual flush in the future * improved the influxdb line formatter * removed variables like 'names2' by reorganizing the code * used Arc::clone(&foo) instead of foo.clone() (better visibilty) * used CamelCase for the DeletableProperties proxmox: Dominik Csapak (2): proxmox-async: add udp::connect() helper proxmox-metrics: implement metrics server client code Cargo.toml | 1 + proxmox-async/Cargo.toml | 2 +- proxmox-async/src/io/mod.rs | 2 + proxmox-async/src/io/udp.rs | 36 +++++ proxmox-metrics/Cargo.toml | 21 +++ proxmox-metrics/debian/changelog | 5 + proxmox-metrics/debian/copyright | 16 +++ proxmox-metrics/debian/debcargo.toml | 7 + proxmox-metrics/src/influxdb/http.rs | 185 ++++++++++++++++++++++++++ proxmox-metrics/src/influxdb/mod.rs | 7 + proxmox-metrics/src/influxdb/udp.rs | 86 ++++++++++++ proxmox-metrics/src/influxdb/utils.rs | 50 +++++++ proxmox-metrics/src/lib.rs | 117 ++++++++++++++++ 13 files changed, 534 insertions(+), 1 deletion(-) create mode 100644 proxmox-async/src/io/udp.rs create mode 100644 proxmox-metrics/Cargo.toml create mode 100644 proxmox-metrics/debian/changelog create mode 100644 proxmox-metrics/debian/copyright create mode 100644 proxmox-metrics/debian/debcargo.toml create mode 100644 proxmox-metrics/src/influxdb/http.rs create mode 100644 proxmox-metrics/src/influxdb/mod.rs create mode 100644 proxmox-metrics/src/influxdb/udp.rs create mode 100644 proxmox-metrics/src/influxdb/utils.rs create mode 100644 proxmox-metrics/src/lib.rs -- 2.30.2 >From 7dfc34ef9f172f5ecb0554532bdcaa090184d24a Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 2 Feb 2022 10:41:52 +0100 Subject: [PATCH proxmox-backup v5 0/8] *** SUBJECT HERE *** *** BLURB HERE *** Dominik Csapak (8): use 'fs_info' from proxmox-sys pbs-api-types: add metrics api types pbs-config: add metrics config class backup-proxy: decouple stats gathering from rrd update proxmox-backup-proxy: send metrics to configured metrics server api: add metricserver endpoints ui: add window/InfluxDbEdit ui: add MetricServerView and use it Cargo.toml | 1 + pbs-api-types/src/lib.rs | 15 + pbs-api-types/src/metrics.rs | 138 ++++++++ pbs-config/Cargo.toml | 1 + pbs-config/src/lib.rs | 1 + pbs-config/src/metrics.rs | 115 +++++++ src/api2/admin/datastore.rs | 4 +- src/api2/admin/metricserver.rs | 91 +++++ src/api2/admin/mod.rs | 2 + src/api2/config/metricserver/influxdbhttp.rs | 314 +++++++++++++++++ src/api2/config/metricserver/influxdbudp.rs | 269 +++++++++++++++ src/api2/config/metricserver/mod.rs | 16 + src/api2/config/mod.rs | 2 + src/api2/node/status.rs | 11 +- src/api2/status.rs | 4 +- src/bin/proxmox-backup-proxy.rs | 342 +++++++++++++++---- src/tools/disks/mod.rs | 21 +- www/Makefile | 2 + www/NavigationTree.js | 6 + www/config/MetricServerView.js | 145 ++++++++ www/window/InfluxDbEdit.js | 218 ++++++++++++ 21 files changed, 1619 insertions(+), 99 deletions(-) create mode 100644 pbs-api-types/src/metrics.rs create mode 100644 pbs-config/src/metrics.rs create mode 100644 src/api2/admin/metricserver.rs create mode 100644 src/api2/config/metricserver/influxdbhttp.rs create mode 100644 src/api2/config/metricserver/influxdbudp.rs create mode 100644 src/api2/config/metricserver/mod.rs create mode 100644 www/config/MetricServerView.js create mode 100644 www/window/InfluxDbEdit.js -- 2.30.2