This change adds a systemd-timer triggered script to collect
prometheues-style metrics from a configured list of endpoints on the
metrics producer side (eg. Postgres server). These will be written to
the metrics storage DB (VictoriaMetrics) by bin/monitor. The buffer
exists in case certain parts of the stack (either monitor or
VictoriaMetrics) are unavailable, we are able to catch up and recover
without losing data. With the default buffer size (20MiB), we can
tolerage about 30 minutes of downtime for PG metrics.
To add this functionality to other resources, one can configure the
systemd-timer in a similar manner as done in this change for
PostgresServer and provide the configuration as part of the
`metrics_config` method, like this:
{
# Array of endpoints to collect metrics from
endpoints: [],
# Maximum size of the pending buffer in MiB
max_pending_buffer_size_mib: 20,
# Interval for collecting metrics in seconds or as a time span string
interval: "15s",
# Additional label names and values to be added to the collected metrics
additional_labels: {"foo": "bar"}
}