Simple Python script to check if backups created by Duplicati are correctly present at Dropbox (if that target was selected).
Outputs data in format acceptable by Prometheus that include path on Dropbox and timestamp of newest file in provided directory with Duplicati backups.
python3 -m pip install -r requirements.txt
./ddc.py DROPBOX_API_TOKEN PROMETHEUS_ALIAS PATH_ON_DROPBOX
PATH_ON_DROPBOX
is full path to directory on Dropbox, eg."/Applications/Duplicati backup/COMPUTER_ONE/C_DRIVE"
PROMETHEUS_ALIAS
is any ASCII alphanumeric string that'll be appended as metric sufixDROPBOX_API_TOKEN
is non-expiring read-only token to Dropbox API
- Go to Dropbox App Console - https://www.dropbox.com/developers/apps
- Click Create App
- Select Scoped access
- Select Full Dropbox since we will be accessing data of other application
- Provide some name - must be globally unique accross all Dropbox application, but can be random string
- In page you are taken to after creation of application go to tab Permissions
- Navigate to Individual Scopes
- Find Files and folders
- Select checkbox
files.metadata.read
- Click Submit
- In the same page go to tab Settings
- Navigate to OAuth 2
- In Access token expiration dropdown select No expiration (this should be fixed in future)
- Find section Generated access token
- Click Generate
- Store API token in safe place
It was created with cron daily execution in mind that stores files consumed by collector.textfile
in prometheus_nodexporter.
$ ./ddc.py XXXXXXXXXXXXXXXXXXXXXXXX ComputerOneCDrive "/Applications/Duplicati backup/COMPUTER_ONE/C_DRIVE"
dropbox_duplicati_latest_file_ComputerOneCDrive 1611363686