Skip to main content

Usage

truenas-backup is a simple tool to fetch configuration backups from the TrueNAS installation using the JSON-RPC API.

Installation

As the API client is not published as a package, you’ll need to install the dependency manually

pip install git+https://github.com/truenas/api_client.git

Arguments

-h, --help

show the help message and exit.

-c FILE, --config FILE

the configuration file (default: ~/.config/truenas-backup/config.yml)

-o FILE, --output FILE

the output file. The file name can contain strftime directives. If the argument is specified, directory, name and keep fields of the configuration are ignored.

Configuration file

The truenas-backup needs a configuration file (default ~/.config/truenas-backup/config.yml). As the file contains secrets, take care to set reasonable permissions. The file is in the YAML format.

Configuration file

truenas:
   host: truenas.local[:port]
   api_user: truenas_admin
   api_key: ...
   ssl_verify: false
   call_timeout: 20
   backup_password: ...
output:
   directory: .
   name: "truenas-%Y%m%d-%H%M.backup"
   keep: 12

All fields except api_user and api_key are optional. The user the API key was generated for needs to have the FULL_ADMIN role (TrueNAS requirement).

host is a hostname or an IP address, and an optional port. Secure connection will be used.

The backup file is compressed using gzip first, then encrypted if backup_password is specified. It can be decrypted and unpacked manually using

openssl aes-256-cbc -d -md sha512 -pbkdf2 -iter 100000 -in ... | tar tvfz -

name specifies the name of the output file. strftime directives are allowed.

keep removes all but the most recent *.backup files from the directory, that in this case has to be specified and has to be an absolute path.

directory has to already exist. As the backup is not encrypted and contains secrets the permissions should be set accordingly.

Observability

The backups done can be exported through prometheus text-file format and consumed by the node exporter’s textfile collector. If the metrics key exists, the file is atomically populated after each backup run.

metrics:
    directory: "/var/local/lib/prom_metrics"
    suffix: "my-truenas"

directory is mandatory and specifies the path of the directory passed as the --collector.textfile.directory for the node_exporter. It has to already exist. suffix is optional and will be appended to the file name to distinguish metrics files generated by different configurations. For the above configuration the full file name will be /var/local/lib/prom_metrics/truenas-backup-my-truenas.prom.

Metadata

Release files for truenas-backup-tool 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for truenas-backup-tool 0.1.1
File Size Uploaded
truenas_backup_tool-0.1.1.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for truenas-backup-tool 0.1.1
File Interpreter ABI Platform
truenas_backup_tool-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / truenas_backup_tool-0.1.1.tar.gz

Download URL truenas_backup_tool-0.1.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c8837e8fab5b13dd27ac1a713ce35611b928b9af8b2f03c5041086908c732861
BLAKE2b-256 checksum
How to use checksums
55ac24a1bcda45a396df8f12adb68ab497ec610f6f5d0195fafcb19c0f2c0871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / truenas_backup_tool-0.1.1-py3-none-any.whl

Download URL truenas_backup_tool-0.1.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8c1edb5c410889b1b2ab2d4085ccccfbf4727770f4e777aaf89836f7d6dd136
BLAKE2b-256 checksum
How to use checksums
74941efb553d3a55a88cd92d0f1f35c5c555b1806bafa4ddf5941851d04c7cad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page