Skip to main content

Send borg backup updates over MQTT

Project description

Borg -> MQTT

Send borgbackup updates over MQTT, including support for Home Assistant MQTT autodiscovery. Sensors include

  • Total/unique chunks
  • (Un)compressed size
  • Depuplicated (Un)compressed size
  • Total number of backups
  • Most recent backup

Installation

Install on any system as python library using

pip install borg2mqtt

Whatever system it is installed on will need the ssh keys for your backup locations.

Configuration

borg2mqtt reads MQTT and repository information from a configuration yaml file. An example configuration file can be generated by running

borg2mqtt -c path/config.yml generate

If portion path/config.yml is left off, borg2mqtt defaults to saving/looking for the configuration file at $HOME/.config/borg2mqtt/config.yml.

The configuration file is mostly self-explanatory and looks as follows:

# -------------- Sample configuration file -------------- #
# These are the default MQTT values - none are required
mqtt:
  host: localhost
  port: 1883
  user: ""
  password: ""

# Put in as many repositories as desired
repos:
    # Required
  - repo: user@address:/path/to/backup
    # Optional, defaults to the same as repo if not specified
    # This will be used to make entity_ids in HA
    name: Local Data
    # Optional
    key: ""
    # Optional, choose one of kB, MB, GB, TB. Defaults to GB.
    units: GB

Usage

To send the Home Assistant MQTT auto-discovery message, run

borg2mqtt setup

Then to update sensor information run

borg2mqtt update

This can be included in a cron job, borgmatic, etc to send updates as needed. As this is a "local push" option, it should be more efficient than any local polling option that could be included in Home Assistant.

Additionally, a single repository can be updated through it's name found in the configuration file by

borg2mqtt update -n "My Repo"

Additional Options

All options can always be shown by using flag --help. Additionally, varying levels of verbose output can be included through -vvv, put before the command type.

Contributing

All pull requests are more than welcome. Please usse the pre-commit hooks to verify your code before making a pull request. If any bugs are found, feel free to open an issue with your verbose output (-vvv) included.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

borg2mqtt-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

borg2mqtt-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file borg2mqtt-0.1.1.tar.gz.

File metadata

  • Download URL: borg2mqtt-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for borg2mqtt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b6e41c9a7e3a0f5c5234613277ad8fe860015349e7423fe8038902145d987265
MD5 b02ab0d28d544a65851499b2c0b71c12
BLAKE2b-256 49cff7406c16e7d8643ae9481011d6de2aa8e7cd1cbe4d0e5ca2d4c33c16f3ff

See more details on using hashes here.

File details

Details for the file borg2mqtt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: borg2mqtt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for borg2mqtt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2c96772de9582655b233a79763235a9eb164c2b21d528fafdc8c6036dcc2765
MD5 e9771da2fd7b9fd8165c3c471a82def9
BLAKE2b-256 c909b40839a7207227717dafecab7b33bacf60f5d363f7f36caf30d5a8b66814

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page