Categorygithub.com/sapcc/swift-health-exporter
repositorypackage
1.0.2
Repository: https://github.com/sapcc/swift-health-exporter.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Swift health exporter

CI Coverage Status Go Report Card

This exporter uses the swift-dispersion-report and swift-recon tools to emit Prometheus metrics about the health of an OpenStack Swift cluster.

The exporter has been tested with OpenStack Swift Train (v2.23.0) and above. For older versions of Swift, you might want to look at swift-health-statsd.

Installation

The only required build dependency is Go:

make install

This will install the binary in /usr/bin/.

Usage

swift-health-exporter will find the executables for swift-recon and swift-dispersion-report in the directories named by the $PATH environment variable.

To start collecting metrics, you simply need to:

swift-health-exporter

Metrics are exposed at port 9520 by default. This port has been allocated for swift-health-exporter.

You can change the listening address and the port using the --web.listen-address flag.

swift-health-exporter --web.listen-address 127.0.0.1:9520

If the swift-recon and swift-dispersion-report are not in the directories named by the $PATH then you must provide the respective paths to these executables using the configuration options.

Configuration options

When a particular collector fails once, swift-health-exporter will continue to report the metric values for it from the previous collection. A collection is considered to have failed and an error is only reported after the max failure attempts have been exceeded.

You can change the value for the max failures using the --collector.max-failures flag.

Additionally, the following environment variables are recognized:

VariableRequiredDescription
SWIFT_DISPERSION_REPORT_PATHyes, if executable not in $PATH and dispersion collector is enabledPath to the swift-dispersion-report executable.
SWIFT_RECON_PATHyes, if executable not in $PATH and any recon.<name> collector is enabledPath to the swift-recon executable.
SWIFT_CLUSTER_RAW_CAPACITY_BYTESnoThis cluster capacity value (in bytes) will be used for swift_cluster_storage_capacity_bytes metric instead of calculating total capacity using swift-recon tool.
DEBUGnoIf this option is set to true then swift-health-exporter will also output debug logs.

Collectors

Collectors are enabled by providing a --collector.<name> flag. Collectors that are enabled by default can be disabled by providing a --no-collector.<name> flag.

NameEnabled by default
dispersionno
recon.diskusageno
recon.driveauditno
recon.md5yes
recon.quarantinedno
recon.replicationno
recon.shardingno
recon.unmountedno
recon.updater_sweep_timeno

Optionally host timeout for recon collector and context timeout for both collectors can be provided using the respective flags. Use --help for usage info and default timeout values.

Metrics

dispersion

MetricLabels
swift_dispersion_container_copies_expected
swift_dispersion_container_copies_found
swift_dispersion_container_copies_missing
swift_dispersion_container_overlapping
swift_dispersion_object_copies_expected
swift_dispersion_object_copies_found
swift_dispersion_object_copies_missing
swift_dispersion_object_overlapping
swift_dispersion_task_exit_codequery
swift_dispersion_errors

recon

MetricLabels
swift_recon_task_exit_codequery

recon.diskusage

MetricLabels
swift_cluster_storage_capacity_bytes
swift_cluster_storage_free_bytes
swift_cluster_storage_used_bytes
swift_cluster_storage_used_percent_by_diskstorage_ip, disk
swift_cluster_storage_used_percent

recon.driveaudit

MetricLabels
swift_cluster_drives_audit_errorsstorage_ip

recon.md5

MetricLabels
swift_cluster_md5_allkind
swift_cluster_md5_errorsstorage_ip, kind
swift_cluster_md5_matchedstorage_ip, kind
swift_cluster_md5_not_matchedstorage_ip, kind

recon.quarantined

MetricLabels
swift_cluster_accounts_quarantinedstorage_ip
swift_cluster_containers_quarantinedstorage_ip
swift_cluster_objects_quarantinedstorage_ip

recon.replication

MetricLabels
swift_cluster_accounts_replication_agestorage_ip
swift_cluster_accounts_replication_durationstorage_ip
swift_cluster_containers_replication_agestorage_ip
swift_cluster_containers_replication_durationstorage_ip
swift_cluster_objects_replication_agestorage_ip
swift_cluster_objects_replication_durationstorage_ip

recon.sharding

MetricLabels
swift_cluster_containers_sharding_audit_root_attemptedstorage_ip
swift_cluster_containers_sharding_audit_root_failurestorage_ip
swift_cluster_containers_sharding_audit_root_successstorage_ip
swift_cluster_containers_sharding_audit_root_has_overlapstorage_ip
swift_cluster_containers_sharding_audit_root_num_overlapstorage_ip
swift_cluster_containers_sharding_audit_shard_attemptedstorage_ip
swift_cluster_containers_sharding_audit_shard_failurestorage_ip
swift_cluster_containers_sharding_audit_shard_successstorage_ip
swift_cluster_containers_sharding_cleaved_attemptedstorage_ip
swift_cluster_containers_sharding_cleaved_failurestorage_ip
swift_cluster_containers_sharding_cleaved_max_timestorage_ip
swift_cluster_containers_sharding_cleaved_min_timestorage_ip
swift_cluster_containers_sharding_cleaved_successstorage_ip
swift_cluster_containers_sharding_created_attemptedstorage_ip
swift_cluster_containers_sharding_created_failurestorage_ip
swift_cluster_containers_sharding_created_successstorage_ip
swift_cluster_containers_sharding_scanned_attemptedstorage_ip
swift_cluster_containers_sharding_scanned_failurestorage_ip
swift_cluster_containers_sharding_scanned_max_timestorage_ip
swift_cluster_containers_sharding_scanned_min_timestorage_ip
swift_cluster_containers_sharding_scanned_successstorage_ip
swift_cluster_containers_sharding_misplaced_attemptedstorage_ip
swift_cluster_containers_sharding_misplaced_failurestorage_ip
swift_cluster_containers_sharding_misplaced_foundstorage_ip
swift_cluster_containers_sharding_misplaced_placedstorage_ip
swift_cluster_containers_sharding_misplaced_successstorage_ip
swift_cluster_containers_sharding_misplaced_unplacedstorage_ip
swift_cluster_containers_sharding_visited_attemptedstorage_ip
swift_cluster_containers_sharding_visited_completedstorage_ip
swift_cluster_containers_sharding_visited_failurestorage_ip
swift_cluster_containers_sharding_visited_skippedstorage_ip
swift_cluster_containers_sharding_visited_successstorage_ip
swift_cluster_containers_sharding_in_progress_activestorage_ip, account, container
swift_cluster_containers_sharding_in_progress_cleavedstorage_ip, account, container
swift_cluster_containers_sharding_in_progress_createdstorage_ip, account, container
swift_cluster_containers_sharding_in_progress_errorstorage_ip, account, container
swift_cluster_containers_sharding_in_progress_foundstorage_ip, account, container
swift_cluster_containers_sharding_in_progress_object_countstorage_ip, account, container
swift_cluster_containers_sharding_candidates_foundstorage_ip
swift_cluster_containers_sharding_candidates_object_countstorage_ip, account, container

recon.unmounted

MetricLabels
swift_cluster_drives_unmountedstorage_ip

recon.updater_sweep_time

MetricLabels
swift_cluster_containers_updater_sweep_timestorage_ip
swift_cluster_objects_updater_sweep_timestorage_ip