Skip to main content

Overview

backmon's binary must run either on a bare-metal host or inside a Docker container. It then can be configured through a configuration file. In it, you specify which disks, local filesystem paths, S3 buckets or Google Cloud Storage buckets, have to be monitored.

backmon inspects each of the configured disks. If a backup definition is found in a disk, its backup definition is applied.

backmon tries to locate the configuration file config.yaml in the following directories, priority in the defined order:

  • local directory: ./config.yaml
  • ${HOME}/.backmon/config.yaml
  • /etc/backmon/config.yaml

In the configuration file, you can use environment placeholders like __${VAR}__. Those placeholders will be replaced during the startup of backmon with the corresponding environment variables. You have to place the configuration file at /etc/backmon/config-raw.yaml.

Multiple placeholders in a single element are also supported, e. g.

endpoint: "__${S3_ENDPOINT_HOST}__:__${S3_ENDPOINT_PORT}__"

Reloading the configuration​

backmon reads the configuration file when it starts. To apply a changed file without a restart, send SIGHUP to the process (see Standalone) or press r in interactive mode. backmon then reads the same file again and rescans all disks.

ConfigurationApplied by a reload
environmentsYes. Added environments are monitored, removed ones are dropped together with their metrics. Changed ones (e.g. rotated credentials, disks) keep their metrics until the rescan has finished.
update_interval, log_levelYes
http.basic_auth, downloads.enabledYes, for the next request
port, http.tlsNo. backmon logs a warning that a restart is required.
  • An invalid configuration file is rejected as a whole, even if only one environment is invalid: backmon logs the error and keeps running with the active configuration. The metric backmon_config_last_reload_successful is 0 until a reload succeeds.
  • Placeholders like __${VAR}__ are replaced again, but with the environment variables the process has been started with. Changed environment variables always need a restart.
  • In Kubernetes, the Helm chart restarts the pod instead of reloading.

Command line options for backmon​

OptionDefaultDescription
--debugfalse (bool)Enable debug output; overwrites any log setting from config.yaml

Sample configuration file​


port: 8080
# for update_interval use `time.ParseDuration` format from https://pkg.go.dev/time#example-ParseDuration
# e.g. 1m, 1h, 86400s etc
update_interval: 1m
downloads:
enabled: true

http:
basic_auth:
username: my_username
password: my_password
tls:
certificate: server.rsa.crt
key: server.rsa.key
strict: true

environments:
env_1:
path: /my/backups
disks:
include:
- my-bucket-1
exclude:
- my-secret-bucket-2
- "/regular_ex.*ssions_are_supported/"
all_others: exclude
env_2:
s3:
access_key_id: my_access_key_id
secret_access_key: my_secret_access_key
auto_discover_disks: true
disks:
include:
- my-bucket-1
exclude:
- my-secret-bucket-2
- "/regular_ex.*ssions_are_supported/"
all_others: exclude
env_3:
gcs:
project_id: my-gcp-project
credentials_file: /etc/backmon/gcs-service-account.json
disks:
exclude:
- my-secret-bucket-3

Available configuration keys​

KeyDefaultRequiredDescription
port80 (int)NoDefault HTTP port to listen for requests. TLS is not supported at the moment. Consider using a proxy if you need encryption.
update_interval1h (duration)NoChecks each disk in that duration interval. time.ParseDuration format must be used.
log_level<empty> (one of debug, info)NoUsed log level; will be overwritten if --debug is used.
downloads.enabledfalseNoIf true, the latest artifact of a monitored backup disk can be downloaded. This is disabled by default for security reasons (#1).
http.basic_auth.username<empty> (string)NoUsername for HTTP Basic Authentication. If this is set, http.basic_auth.password must be also set.
http.basic_auth.password<empty> (string)NoPassword for HTTP Basic Authentication. If this is set, http.basic_auth.username must be also set.
http.tls.certificate<empty> (string)NoPath to certificate file. If this is set, http.tls.key must be also set.
http.tls.key<empty> (string)NoPath to private key file. If this is set, http.tls.certificate must be also set.
http.tls.strictfalse (bool)NoIf set to true, a preferred TLS default configuration is used.
environments<empty> (list of environment)NoEach environment to check.
environments[]<empty> (string)YesName of environment.
environments[$env].definitionsbackup_definitions.yaml (string)NoYAML file containing the backup definitions.
environments[$env].path<empty> (string)NoLocal path to check for. If you use the path parameter, other parameters specific for S3 or Google Cloud Storage are ignored.
environments[$env].s3.regioneu-central-1 (string)NoAWS region
environments[$env].s3.access_key_id<empty> (string)NoAWS Access Key. Without access_key_id and secret_access_key, the default credential chain of the AWS SDK is used, e.g. IRSA.
environments[$env].s3.secret_access_key<empty> (string)NoAWS Secret Access Key. Required, if access_key_id is set.
environments[$env].s3.assume_role_arn<empty> (string)NoARN of an IAM role which is assumed with the credentials above (sts:AssumeRole), e.g. to access buckets of another AWS account.
environments[$env].s3.endpoint<empty> (string)NoCustom AWS S3 endpoint. This must be used for Minio buckets or if you are using a local S3 instance.
environments[$env].s3.force_path_stylefalse (bool)NoUse path-style for that S3 bucket. This is deprecated by AWS S3 and should be probably false.
environments[$env].s3.insecurefalse (bool)NoWhether to use HTTP or HTTPS to access the S3 endpoint. This is intended primarily for accessing a local S3 endpoint like MinIO.
environments[$env].s3.tls_skip_verifyfalse (bool)NoWhether to verify the X.509 certificated presented by the S3 endpoint. This is intended primarily for accessing a local S3 endpoint which uses a self signed certificate
environments[$env].s3.proxy<empty> (string)NoHTTP proxy for all requests of this environment, including the requests to AWS STS, e.g. http://my-proxy:3128. Without it, the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY apply.
environments[$env].s3.token<empty> (string)NoAWS STS session token, if access_key_id and secret_access_key are temporary credentials. You can leave that empty.
environments[$env].s3.auto_discover_diskstrue (bool)NoAutomatically iterate over each S3 bucket.
environments[$env].gcs.project_id<empty> (string)NoGoogle Cloud project whose buckets are discovered. Defaults to the project of the credentials; required for auto_discover_disks if the credentials do not belong to a project.
environments[$env].gcs.credentials_file<empty> (string)NoPath to the JSON key file of a service account. Without credentials_file and credentials_json, Application Default Credentials are used.
environments[$env].gcs.credentials_json<empty> (string)NoContent of the JSON key file of a service account. Mutually exclusive with credentials_file.
environments[$env].gcs.anonymousfalse (bool)NoSend requests without authentication. This is intended for public buckets and emulators.
environments[$env].gcs.endpoint<empty> (string)NoCustom endpoint of the Cloud Storage JSON API instead of https://storage.googleapis.com, e.g. for emulators.
environments[$env].gcs.proxy<empty> (string)NoHTTP proxy for all requests of this environment. Without it, the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY apply.
environments[$env].gcs.auto_discover_diskstrue (bool)NoAutomatically iterate over each bucket of the project.
environments[$env].disks.include<empty> (list of strings)NoOnly include the disks with the given name; case-sensitive; regular expressions are supported.
environments[$env].disks.exclude<empty> (list of strings)NoOnly include the disks with the given name; case-sensitive; regular expressions are supported.
environments[$env].disks.all_othersinclude (one of include, exclude)NoBehaviour for disks which are not explicitly included or excluded.

disks​

The disks section allows you to include or exclude disks which have been found during the discovery phase.

  • A disk is included if it is defined in disks.include or one of those regular expressions matches
  • A disk is excluded if it is defined in disks.exclude or one of those regular expressions matches
  • If a disk is defined in disks.include and disks.exclude, the behaviour of disks.all_others is applied (include by default)
  • If a disk is not explicitly defined in disks.include or disks.exclude, the behaviour of disks.all_others is applied (include by default)
  • If a disk contains a .backmonignore marker file of the root of the disk, the disk is excluded - no matter of any disks.* configurations.

To use a regular expression in disks.include or disks.exclude, you have to put a slash (/) before and after the regular expression:

disks:
include:
- "/(\d{8})\-etcd/"
exclude:
- "/regular_ex.*ssions_are_supported/"
info

If you have set environments[$env].s3.auto_discover_disks or environments[$env].gcs.auto_discover_disks to false, only the disks.include configuration parameter makes any sense.