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}" rm -f "${NPBACKUP_CONF_FILE}"
cp "${NPBACKUP_CONF_FILE_TEMPLATE}" "${NPBACKUP_CONF_FILE}" cp "${NPBACKUP_CONF_FILE_TEMPLATE}" "${NPBACKUP_CONF_FILE}"
sed -i "s%### TENANT ###%${tenant}%g" "${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}" sed -i "s%### VM ###%${vm}%g" "${NPBACKUP_CONF_FILE}"
"$NPBACKUP_EXECUTABLE" --config-file "${NPBACKUP_CONF_FILE}" --backup --force >> "$LOG_FILE" 2>&1 "$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 conf_version: 3.0
# (C) 2022-2023 NetInvent repos:
default:
backup: repo_uri:
compression: auto repo_group: default_group
exclude_caches: true backup_opts:
exclude_files: paths:
#- excludes/generic_excluded_extensions - ### SOURCE ###
#- excludes/generic_excludes tags:
#- excludes/windows_excludes - ### VM ###
# - 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 ###
source_type: files_from_verbatim source_type: files_from_verbatim
use_fs_snapshot: false # Use VSS snapshot on Windows (needs administrator rights), will fallback to non VSS on failure compression: auto
ignore_cloud_files: false # Don't complain when pointers to files in cloud (onedrive, nextcloud...) cannot be backed up use_fs_snapshot: false
pre_exec_command: '' ignore_cloud_files: true
pre_exec_timeout: 3600 exclude_caches: true
pre_exec_failure_is_fatal: false one_file_system: true
post_exec_command: ''
post_exec_timeout: 3600
post_exec_failure_is_fatal: false
tags: ### VM ###
additional_parameters:
priority: low priority: low
excludes_case_ignore: false
repo: exclude_files: []
repository: exclude_patterns: []
password: exclude_files_larger_than: 0.0 KiB
password_command: additional_parameters:
# Backup age, in minutes, which is the minimum time between two backups additional_backup_only_parameters:
minimum_backup_age: 0 minimum_backup_size_error: 10.0 MiB
upload_speed: 0 # in KiB, use 0 for unlimited upload speed pre_exec_commands:
download_speed: 0 # in KiB, use 0 for unlimited download speed pre_exec_per_command_timeout: 3600
backend_connections: 0 # Fine tune simultaneous connections to backend, use 0 for standard configuration pre_exec_failure_is_fatal: false
post_exec_commands:
identity: post_exec_per_command_timeout: 3600
# ${HOSTNAME} is a variable containing the hostname as exposed by platform.node() post_exec_failure_is_fatal: false
# ${RANDOM}[n] is a variable containing 'n' random alphanumeric char post_exec_execute_even_on_backup_error: true
machine_id: ${HOSTNAME} repo_opts:
machine_group: repo_password:
repo_password_command:
prometheus: minimum_backup_age: 1440
## Supervision upload_speed: 800.0 Mib
metrics: true download_speed: 0.0 Kib
# Available variables: ${HOSTNAME}, ${RANDOM}[n], ${MACHINE_ID}, ${MACHINE_GROUP}, ${BACKUP_JOB} 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: ### VM ### 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 group: ${MACHINE_GROUP}
# example: https://push.monitoring.example.tld/metrics/job/npbackup env:
# example: https://push.monitoring.example.tld/metrics/job/${BACKUP_JOB} where ${BACKUP_JOB} is defined in prometheus_backup_job env_variables: {}
# example: /var/lib/prometheus/collector/mytextfile 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: destination:
no_cert_verify: false
# prometheus metrics upload password
# private keys
http_username: http_username:
http_password: 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: additional_labels:
- tenant=### TENANT ### npf_tenant: ### TENANT ###
- backup_type=server backup_type: vm
env: global_options:
variables: auto_upgrade: false
# - SOME_ENV=Value auto_upgrade_interval: 10
options:
auto_upgrade: true
auto_upgrade_server_url: auto_upgrade_server_url:
auto_upgrade_server_username: auto_upgrade_server_username:
auto_upgrade_server_password: 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_host_identity: ${MACHINE_ID}
auto_upgrade_group: ${MACHINE_GROUP} auto_upgrade_group: ${MACHINE_GROUP}
backup_admin_password: