Prometheus exporter for cassandra-medusa.
The metrics are collected based on result of medusa list-backups --output json command. You need to run exporter on the same host where Medusa was installed or inside Docker.
Changes from this cassandra-medusa/pull/899 PR are required for the exporter.
To get a dashboard for visualizing the collected metrics, you can use a ready-made dashboard Medusa Exporter Dashboard or make your own.
| Metric | Description | Labels | Additional Info |
|---|---|---|---|
medusa_backup_info |
backup info | backup_name, backup_type, prefix, start_time | Values description:1 - info about backup is exist. |
medusa_backup_status |
backup status | backup_name, backup_type | Values description:0 - backup is complete,1 - backup is not complete. |
medusa_backup_duration_seconds |
backup duration in seconds | backup_name, backup_type, start_time, stop_time | |
medusa_backup_size_bytes |
backup size in bytes | backup_name, backup_type | |
medusa_backup_objects |
number of objects in backup | backup_name, backup_type | |
medusa_backup_completed_nodes |
number of completed nodes in backup | backup_name, backup_type | |
medusa_backup_incomplete_nodes |
number of incomplete nodes in backup | backup_name, backup_type | |
medusa_backup_missing_nodes |
number of missing nodes in backup | backup_name, backup_type | |
medusa_node_backup_info |
node backup info | backup_name, backup_type, node_fqdn, prefix, release_version, server_type, start_time | Values description:1 - info about node backup is exist.For missing nodes: release_version, server_type, and start_time labels are set to none. |
medusa_node_backup_status |
node backup status | backup_name, backup_type, node_fqdn | Values description:0 - node backup is complete,1 - node backup is not complete,2 - node is missing. |
medusa_node_backup_duration_seconds |
node backup duration in seconds | backup_name, backup_type, node_fqdn, start_time, stop_time | For missing nodes: start_time and stop_time labels are set to none, value is 0. |
medusa_node_backup_size_bytes |
node backup size in bytes | backup_name, backup_type, node_fqdn | For missing nodes: value is 0. |
medusa_node_backup_objects |
number of objects in node backup | backup_name, backup_type, node_fqdn | For missing nodes: value is 0. |
| Metric | Description | Labels | Additional Info |
|---|---|---|---|
medusa_backup_since_last_completion_seconds |
seconds since the last completed full or differential backup | backup_type | |
medusa_backup_last_duration_seconds |
backup duration for the last full or differential backup | backup_type | |
medusa_backup_last_size_bytes |
backup size for the last full or differential backup | backup_type | |
medusa_backup_last_objects |
number of objects in backup for the last full or differential backup | backup_type |
| Metric | Description | Labels | Additional Info |
|---|---|---|---|
medusa_exporter_build_info |
information about Medusa exporter | branch, goarch, goos, goversion, revision, tags, version | |
medusa_exporter_status |
Medusa exporter get data status | prefix | Values description:0 - errors occurred when fetching information from Medusa,1 - information successfully fetched from Medusa. |
For medusa_backup_duration_seconds and medusa_node_backup_duration_seconds metrics the following logic is applied:
- if backup/node backup is complete then value calculated;
- if backup/node backup is not complete, then value is
0, labelsstop_timeisnone; - for missing nodes: value is
0, labelsstart_timeandstop_timeare set tonone.
For missing nodes, medusa_node_backup_* metrics are set with default values:
medusa_node_backup_info: labelsrelease_version,server_type, andstart_timeare set tonone;medusa_node_backup_status: value is2(missing);medusa_node_backup_duration_seconds,medusa_node_backup_size_bytes,medusa_node_backup_objects: value is0.
For medusa_*_last_* metrics the following logic is applied:
- metrics are calculated only for completed backups;
- if only full completed backups exist, only
backup_type="full"metrics will be set; - if only differential backups exist, only
backup_type="differential"metrics will be set; - if both types exist, both labels will be set with their respective latest backups;
- metrics are not set if no completed backups exist at all.
- Medusa allows creating only differential backups without full backups - in this case, only
backup_type="differential"metrics will be available.
git clone https://github.com/woblerr/medusa_exporter.git
cd medusa_exporter
make build
./medusa_exporter <flags>Available configuration flags:
usage: medusa_exporter [<flags>]
Flags:
-h, --[no-]help Show context-sensitive help (also try --help-long and --help-man).
--web.telemetry-path="/metrics"
Path under which to expose metrics.
--web.listen-address=:19500 ...
Addresses on which to expose metrics and web interface. Repeatable for multiple
addresses. Examples: `:9100` or `[::1]:9100` for http, `vsock://:9100` for vsock
--web.config.file="" Path to configuration file that can enable TLS or authentication. See:
https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md
--collect.interval=600 Collecting metrics interval in seconds.
--medusa.config-file="" Full path to Medusa configuration file.
--medusa.prefix="" Prefix for shared storage.
--log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error]
--log.format=logfmt Output format of log messages. One of: [logfmt, json]
--[no-]version Show application version.Custom config for medusa command can be specified via --medusa.config flag. Full paths must be specified.
For example, --medusa.config=/tmp/medusa.conf.
When --log.level=debug is specified - information of values and labels for metrics is printing to the log.
The flag --web.config.file allows to specify the path to the configuration for TLS and/or basic authentication.
The description of TLS configuration and basic authentication can be found at exporter-toolkit/web.
- Register
medusa_exporter(already builded, if not - execmake buildbefore) as a systemd service:
make prepare-serviceValidate prepared file medusa_exporter.service and run:
sudo make install-service- View service logs:
journalctl -u medusa_exporter.service- Delete systemd service:
sudo make remove-serviceManual register systemd service:
cp medusa_exporter.service.template medusa_exporter.serviceIn file medusa_exporter.service replace {PATH_TO_FILE} to full path to medusa_exporter.
sudo cp medusa_exporter.service /etc/systemd/system/medusa_exporter.service
sudo systemctl daemon-reload
sudo systemctl enable medusa_exporter.service
sudo systemctl restart medusa_exporter.service
systemctl -l status medusa_exporter.serviceYou can use the already prepared rpm/deb package to install the exporter. Only the medusa_exporter binary and the service file are installed by package.
For example:
rpm -ql medusa_exporter
/etc/systemd/system/medusa_exporter.service
/usr/bin/medusa_exporterRun the unit tests:
make testRun the end-to-end tests:
make test-e2e