Update KVM script for NPBackup v3

This commit is contained in:
deajan 2024-06-04 19:45:39 +02:00
parent 28a9d121ae
commit 4528cfe8b5
2 changed files with 120 additions and 77 deletions

View file

@ -125,7 +125,7 @@ function run_backup {
rm -f "${NPBACKUP_CONF_FILE}"
cp "${NPBACKUP_CONF_FILE_TEMPLATE}" "${NPBACKUP_CONF_FILE}"
sed -i "s%### TENANT ###%${tenant}%g" "${NPBACKUP_CONF_FILE}"
sed -i "s%### SOURCE ###%- ${BACKUP_FILE_LIST}%g" "${NPBACKUP_CONF_FILE}"
sed -i "s%### SOURCE ###%${BACKUP_FILE_LIST}%g" "${NPBACKUP_CONF_FILE}"
sed -i "s%### VM ###%${vm}%g" "${NPBACKUP_CONF_FILE}"
"$NPBACKUP_EXECUTABLE" --config-file "${NPBACKUP_CONF_FILE}" --backup --force >> "$LOG_FILE" 2>&1

View file

@ -1,85 +1,128 @@
# NPBackup config file for npbackup v2.2
# (C) 2022-2023 NetInvent
backup:
compression: auto
exclude_caches: true
exclude_files:
#- excludes/generic_excluded_extensions
#- excludes/generic_excludes
#- excludes/windows_excludes
# - excludes/linux_excludes
exclude_case_ignore: false # Exclusions will always have case ignored on Windows systems regarless of this setting
one_file_system: true
## Paths can contain multiple values, one per line, without quotation marks
paths: ### SOURCE ###
conf_version: 3.0
repos:
default:
repo_uri:
repo_group: default_group
backup_opts:
paths:
- ### SOURCE ###
tags:
- ### VM ###
source_type: files_from_verbatim
use_fs_snapshot: false # Use VSS snapshot on Windows (needs administrator rights), will fallback to non VSS on failure
ignore_cloud_files: false # Don't complain when pointers to files in cloud (onedrive, nextcloud...) cannot be backed up
pre_exec_command: ''
pre_exec_timeout: 3600
pre_exec_failure_is_fatal: false
post_exec_command: ''
post_exec_timeout: 3600
post_exec_failure_is_fatal: false
tags: ### VM ###
additional_parameters:
compression: auto
use_fs_snapshot: false
ignore_cloud_files: true
exclude_caches: true
one_file_system: true
priority: low
repo:
repository:
password:
password_command:
# Backup age, in minutes, which is the minimum time between two backups
minimum_backup_age: 0
upload_speed: 0 # in KiB, use 0 for unlimited upload speed
download_speed: 0 # in KiB, use 0 for unlimited download speed
backend_connections: 0 # Fine tune simultaneous connections to backend, use 0 for standard configuration
identity:
# ${HOSTNAME} is a variable containing the hostname as exposed by platform.node()
# ${RANDOM}[n] is a variable containing 'n' random alphanumeric char
machine_id: ${HOSTNAME}
machine_group:
excludes_case_ignore: false
exclude_files: []
exclude_patterns: []
exclude_files_larger_than: 0.0 KiB
additional_parameters:
additional_backup_only_parameters:
minimum_backup_size_error: 10.0 MiB
pre_exec_commands:
pre_exec_per_command_timeout: 3600
pre_exec_failure_is_fatal: false
post_exec_commands:
post_exec_per_command_timeout: 3600
post_exec_failure_is_fatal: false
post_exec_execute_even_on_backup_error: true
repo_opts:
repo_password:
repo_password_command:
minimum_backup_age: 1440
upload_speed: 800.0 Mib
download_speed: 0.0 Kib
backend_connections: 0
retention_policy:
last: 3
hourly: 72
daily: 30
weekly: 4
monthly: 12
yearly: 3
tags: []
keep_within: true
ntp_server:
prometheus:
## Supervision
metrics: true
# Available variables: ${HOSTNAME}, ${RANDOM}[n], ${MACHINE_ID}, ${MACHINE_GROUP}, ${BACKUP_JOB}
backup_job: ### VM ###
# Prometheus metrics destination can be a http / https server with optional basic authentication (pushgateway), or a file path for node textfile collector to pickup
# example: https://push.monitoring.example.tld/metrics/job/npbackup
# example: https://push.monitoring.example.tld/metrics/job/${BACKUP_JOB} where ${BACKUP_JOB} is defined in prometheus_backup_job
# example: /var/lib/prometheus/collector/mytextfile
group: ${MACHINE_GROUP}
env:
env_variables: {}
encrypted_env_variables: {}
name: default
groups:
default_group:
backup_opts:
paths: []
source_type:
tags: []
compression: auto
use_fs_snapshot: true
ignore_cloud_files: true
exclude_caches: true
one_file_system: true
priority: low
excludes_case_ignore: false
exclude_files:
- excludes/generic_excluded_extensions
- excludes/generic_excludes
- excludes/windows_excludes
- excludes/linux_excludes
exclude_patterns: []
exclude_files_larger_than:
additional_parameters:
additional_backup_only_parameters:
minimum_backup_size_error: 10 MiB
pre_exec_commands: []
pre_exec_per_command_timeout: 3600
pre_exec_failure_is_fatal: false
post_exec_commands: []
post_exec_per_command_timeout: 3600
post_exec_failure_is_fatal: false
post_exec_execute_even_on_backup_error: true
repo_opts:
repo_password:
repo_password_command:
minimum_backup_age: 1440
upload_speed: 800 Mib
download_speed: 0 Mib
backend_connections: 0
retention_policy:
last: 3
hourly: 72
daily: 30
weekly: 4
monthly: 12
yearly: 3
tags: []
keep_within: true
ntp_server:
prometheus:
backup_job: ${MACHINE_ID}
group: ${MACHINE_GROUP}
env:
env_variables: {}
encrypted_env_variables: {}
identity:
machine_id: ${HOSTNAME}${RANDOM}[4]
machine_group:
global_prometheus:
metrics: false
instance: ${MACHINE_ID}
destination:
no_cert_verify: false
# prometheus metrics upload password
# private keys
http_username:
http_password:
# prometheus instance, becomes exported_instance when using a push gateway
instance: ### VM ###
# Arbitrary group to filter later backups on
group: ${MACHINE_GROUP}
# Additional prometheus labels
additional_labels:
- tenant=### TENANT ###
- backup_type=server
env:
variables:
# - SOME_ENV=Value
options:
auto_upgrade: true
npf_tenant: ### TENANT ###
backup_type: vm
global_options:
auto_upgrade: false
auto_upgrade_interval: 10
auto_upgrade_server_url:
auto_upgrade_server_username:
auto_upgrade_server_password:
# every 10 NPBackup runs, we'll try an autoupgrade. Never set this lower than 2 since failed upgrades will prevent backups from succeeding
auto_upgrade_interval: 10
# Available variables: ${HOSTNAME}, ${RANDOM}[n], ${MACHINE_ID}, ${MACHINE_GROUP}, ${BACKUP_JOB}
auto_upgrade_host_identity: ${MACHINE_ID}
auto_upgrade_group: ${MACHINE_GROUP}
backup_admin_password: