[pbs-devel] [PATCH proxmox/proxmox-backup v3] add metrics server capability

Dominik Csapak d.csapak at proxmox.com
Fri Dec 17 09:09:51 CET 2021


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

i did not include gui/cli patches yet, as i find the
proxmox-backup-manager options are already too much and i waited for
the gui for some feedback.

for testing, the metric servers can be added either by
calling 'proxmox-backup debug api ...' or by manually editing the
file

ofc, proxmox-backup depends on bumped versions of the proxmox-* crates

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 (3):
  proxmox-sys: make some structs serializable
  proxmox-sys: add FileSystemInformation struct and helper
  proxmox-metrics: implement metrics server client code

 Cargo.toml                            |   1 +
 proxmox-metrics/Cargo.toml            |  20 +++++
 proxmox-metrics/debian/changelog      |   5 ++
 proxmox-metrics/debian/copyright      |  16 ++++
 proxmox-metrics/debian/debcargo.toml  |   7 ++
 proxmox-metrics/src/influxdb/http.rs  | 122 ++++++++++++++++++++++++++
 proxmox-metrics/src/influxdb/mod.rs   |   7 ++
 proxmox-metrics/src/influxdb/udp.rs   |  94 ++++++++++++++++++++
 proxmox-metrics/src/influxdb/utils.rs |  50 +++++++++++
 proxmox-metrics/src/lib.rs            |  89 +++++++++++++++++++
 proxmox-sys/Cargo.toml                |   1 +
 proxmox-sys/src/fs/mod.rs             |  39 ++++++++
 proxmox-sys/src/linux/procfs/mod.rs   |   7 +-
 13 files changed, 455 insertions(+), 3 deletions(-)
 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

proxmox-backup:

Dominik Csapak (6):
  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

 Cargo.toml                                   |   1 +
 pbs-api-types/src/lib.rs                     |   2 +
 pbs-api-types/src/metrics.rs                 | 147 ++++++++
 pbs-config/Cargo.toml                        |   1 +
 pbs-config/src/lib.rs                        |   1 +
 pbs-config/src/metrics.rs                    | 128 +++++++
 src/api2/admin/datastore.rs                  |   4 +-
 src/api2/config/metricserver/influxdbhttp.rs | 275 +++++++++++++++
 src/api2/config/metricserver/influxdbudp.rs  | 245 +++++++++++++
 src/api2/config/metricserver/mod.rs          |  16 +
 src/api2/config/mod.rs                       |   2 +
 src/api2/node/status.rs                      |  10 +-
 src/api2/status.rs                           |   4 +-
 src/bin/proxmox-backup-proxy.rs              | 346 +++++++++++++++----
 src/tools/disks/mod.rs                       |  21 +-
 15 files changed, 1105 insertions(+), 98 deletions(-)
 create mode 100644 pbs-api-types/src/metrics.rs
 create mode 100644 pbs-config/src/metrics.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

-- 
2.30.2






More information about the pbs-devel mailing list