Get last backup status for PRTG sensor

Hi there

I would like to write a prtg sensor to monitor the backup status. Inspired by this PRTG Sensor

If I do have a Backupjob for example DJob1, is ther a possibility to get the following info from the console?
Last run time
Last status (Success, Warning, Error)
Last backup size

Thanks in advance

Hi @ts-man, welcome to the forum!

Adding PRTG Sensor support is an interesting idea - and yes, anything you can see in the GUI (including the 3 items you mentioned) is potentially available in console.

The first trick is getting authentication to connect to the Duplicati server (which is where the information comes from).

I haven’t read through the code you linked to, but some thing to consider include:

  • How to handle if there are multiple backup jobs (some may be scheduled, others now)

  • How to handle if there are multiple Duplicati servers (such as a service / daemon and one more my per-user Tray-Icon servers)

In the end you may find it easier to code a new PRTG specific module directly into Duplicati than to try and authenticate and connect to the existing API…

Thank you @JonMikelV

There are a lot of possibilities to consider.
I’ll start with the following configuration. Windows 2012 R2 Server with Duplicati2 running as a Service.
My Idea was to write a Powershell or Console Script which collects the items per Task (possibly by the Task Name). The script would then outputs PRTG XML Code (What is the XML Schema for EXEXML sensor? | Paessler Knowledge Base). I’ve allready created such scripts.
With this solution you have to add a PRTG Sensor for each backup Task. Which, in my opinion, isn’t the badest idea.

So to start. How can i get the mentioned items for a backup task from the console?

Lets name the Task TestDATA

The Duplicati commandline is not strictly connected to the Duplicati server. So what you’ll likely want is to pull the data from the servers web API.

I’ve written a python client that can fetch this data from the API, so in principle you can just call it and extract the info you want. GitHub - Pectojin/duplicati_client: A command line client for controlling the Duplicati Server

An example of the output from the client:

# duplicati_client get backup 3
- Server:
    ID: '3'
    Last run:
      Duration: 00:09:22
      Started: 11:00 PM
      Stopped: 11:09 PM
    Local database: /root/.config/Duplicati/MXDZYFYGEQ.sqlite
        Action: Get
        Progress: 100.00%
        Speed: 70.34 KB/s
      State: Backup_WaitForUpload
      Task ID: 29
      Last run: 11:00 PM
      Next run: 03:00 AM
      Repeat: 4h
      Backend: 139.33 GB
      Local: 176.66 GB
    Versions: 28

And you can extrapolate the ID’s from the list command:

# duplicati_client list backups
- Server:
    ID: '3'
    Last run: 11:00 PM
    Next run: 03:00 AM
      State: Backup_WaitForUpload
      Task ID: 29
- Email:
    ID: '19'
    Last run: 24/04/2018
    Next run: 01/05/2018
1 Like

This is awesome. I’ll have a look at it next week.

Thank you @Pectojin

This looks interesting… can I use it to trigger actions in the web server? Like telling it to execute a certain job?

In my setup I have two backup jobs: the main one and then a separate job that backs up JUST the database from the main job. Right now I am using the duplicati command line to accomplish that but don’t like how it runs completely independent of the web server piece.

EDIT: Never mind, I actually read the documentation and see that it will do this. Cool, going to play around with it!

Yep, exactly :slight_smile:

That’s the main reason for the client :slight_smile:
It does it’s actions through the web server so it never has that problem

Thank you. Your script led me to the right track

For those interested in a first view. Check out

It’s in a very early state now. I’ll spend my free time in this. So be patient. It’ll take time to progress.


I am playing around with this now and it works great on a Windows PC…thanks!

Also trying it out on a Synology NAS. I got the Linux binary and the “logon” and “logout” commands work, but when I tell it to “list backups” it just hangs.

Any ideas? (I hit CTRL+C after about 5 minutes in the below snippet)

bash-4.3# ./duplicati_client login
Login successful
bash-4.3# ./duplicati_client list backups
^CTraceback (most recent call last):
  File "urllib3/", line 380, in _make_request
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1115, in <module>
  File "", line 99, in main
  File "", line 196, in list_resources
  File "", line 213, in fetch_backup_list
  File "", line 235, in fetch_resource_list
  File "", line 28, in get
  File "requests/", line 72, in get
  File "requests/", line 58, in request
  File "requests/", line 508, in request
  File "requests/", line 618, in send
  File "requests/", line 440, in send
  File "urllib3/", line 601, in urlopen
  File "urllib3/", line 383, in _make_request
  File "http/", line 1197, in getresponse
  File "http/", line 297, in begin
  File "http/", line 258, in _read_status
  File "", line 575, in readinto
[7727] Failed to execute script duplicati_client
bash-4.3# ./duplicati_client logout
Logging out...

Hmm, that looks pretty strange. From the trace it definitely makes the request, but on the socket layer it hangs.

It could either be failing to make the request or the target server isn’t responding (and apparently it doesn’t timeout)

Is this using the Linux binary? I must admit I haven’t tested it on Synology :slight_smile:

Yep Linux binary. Synology does have a Python3 package I can install to possibly run the script directly, but they don’t have a package for the yaml library.

Just bumping this thread… Anyone able to get duplicati_client working on Synology yet?